The current best practice for file I/O in privileged JS is OS.File. It has mechanisms for doing encoding conversion and compressing data. That there is some b2g code using NetUtil/XPCOM instead is a bug, and probably was caused by the relevant code being written prior to the existence of OS.File (or it's doing something that OS.File doesn't support, but I think that's unlikely now).
I don't think XHR is sufficient or particularly well optimized for JS file I/O, though perhaps it could/should be. Gavin On Tue, Apr 29, 2014 at 4:02 AM, Henri Sivonen <hsivo...@hsivonen.fi> wrote: > On Tue, Apr 29, 2014 at 12:12 PM, Henri Sivonen <hsivo...@hsivonen.fi> wrote: >> The Web API for doing I/O is XHR, which would also take care of >> encoding conversion. > > So it turns out that NetUtil.readInputStreamToString() *could* perform > the encoding conversion, too. Yet, callers opt not to do so and > perform conversion on their own later. :-( > > -- > Henri Sivonen > hsivo...@hsivonen.fi > https://hsivonen.fi/ > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform