- What is OS.File?
- What are the relationships with the HTML5 File API?
- None, really. The File API is designed for high-level, highly-restricted manipulation of files by web applications. OS.File is designed for efficient, unrestricted, manipulation of files by Firefox itself and by add-ons.
- Why is Off Main Thread File I/O important?
One thing that all developers need to remember is that the duration of a File I/O operation is unbounded. Depending on the current load of the kernel, the current disk activity, the current load of the bus, the current rotation speed of the disk, the amount of battery power, etc. operations can take an arbitrary amount of time. We are talking about several seconds to execute operations that look trivial, such as closing a file, or checking when it was last modified.
If the operatin is called on the main thread, this means that the whole user experience is stuck for several seconds, which is quite bad.
- What is I/O Efficiency important?
I/O efficiency is all about minimizing the number of actual I/O calls. This is critical because some platforms have extremely slow storage (e.g. smartphones, tablets) and because, regardless of the platforms, doing too much I/O penalizes not just your application but potentially all the applications running on the system, which is quite bad for the user experience. Finally, I/O is often expensive in terms of energy, so wasting I/O is wasting battery.
Consequently, one of the key design choices of OS.File is to provide operations that are low-level enough that they do not hide any I/O from the developer (which could cause the developer to perform more I/O than they think) and, since not all platforms have the same features, offer system-specific information that the developer can use to optimize his algorithms for a platform.
... from the main thread
- Calling OS.File from the main thread (TBD)
- Asynchronous, off-main thread file I/O, main thread API.
- Calling OS.File.DirectoryIterator from the main thread (TBD)
- Asynchronous, off-main thread file directory access, main thread API.
... from a worker thread
- OS.File for workers
- Synchronous file I/O for worker threads
- OS.File.DirectoryIterator for workers (TBD)
- Visiting directories synchronously from a worker thread
... shared components
- Representation of file-related errors
- OS.File.Info (TBD)
- Representation of file information (size, creation date, etc.)