This is excellent -
https://developer.mozilla.org/en-US/docs/JavaScript_OS.File/OS.File_for_the_main_thread
is exactly the kind of API I've been wanting for a long time. I know
it took a lot of work to get there - thank you for your efforts.

A couple of questions:
- some examples use file names without paths, like: |let promise =
OS.File.read("file.txt");|. Are these file names treated as
CWD-relative, or something else? This doesn't seem to be specified
well in the documentation.
- I assume the file name arguments are all nsIFile.path-compatible
across platforms?

Gavin

On Tue, Oct 16, 2012 at 11:47 AM, David Rajchenbach-Teller
<dtel...@mozilla.com> wrote:
>         Hi everybody,
>
>  I am happy to announce that we now have a JavaScript module for Off
> Main Thread File I/O (OMTF). This module is called OS.File and, if you
> need to access files from your code, you really should use it. If you
> own code that does main thread file I/O, you should really migrate it as
> soon as possible.
>
> This is true both for platform code and for add-ons.
>
> Have fun!
>
> *** Off Main Thread File I/O mini-FAQ
>
> Q: Why do we need Off Main Thread File I/O?
> A: Because the duration of *any* I/O operation is unbounded. Even
> closing a file from the main thread can block your UI for several
> seconds, unpredictably.
>
>
> Q: Aren't NetUtils.asyncFetch and NetUtils.asyncCopy sufficient?
> A1: Most uses of NetUtils.asyncCopy I have seen seem to actually perform
> some main thread file I/O behind the scenes. OS.File is generally more
> efficient and doesn't. Please use OS.File for file I/O.
>
> A2: Also, OS.File provides plenty of other Off Main Thread operations,
> including renaming, copying files, traversing directories, etc.
>
> Q: Any documentation?
> A: Glad you asked -
> https://developer.mozilla.org/en-US/docs/JavaScript_OS.File (Work In
> Progress)
>
>
> Cheers,
>  David
>
> --
> David Rajchenbach-Teller, PhD
>  Performance Team, Mozilla
>
>
> _______________________________________________
> 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

Reply via email to