File API:Writer API
- This specification defines an API for writing to files from web applications.
- This API includes:
- A BlobBuilder interface, which enables one to build a Blob from a String.
- A FileSaver interface, which provides methods to write a Blob to a file, and an event model to monitor the progress of those writes.
- A FileWriter interface, which expands on FileSaver to add a richer set of output options.
- A FileWriterSync interface, which provides methods to write and modify files synchronously in a Web Worker.
- The FILE API defined interfaces for reading files, manipulation of Blobs of data, and errors raised by file accesses. This specification extends that work with a way to construct Blobs and with synchronous and asynchronous file-writing interfaces. As with reading, writing files on the main thread should happen asynchronously to avoid blocking UI actions. Long-running writes provide status information through delivery of progress events.
Note that the concept of "main thread" apply to Node.js like EvenLoop architecture which works by default with one only thread. Multi-threaded SSJS implementations may have a concept of main thread maintained alive during the run of an application. This thread should probably take advantages of of such restriction.
Note that this specification also includes the FileSaverSync API (currently missing in the abstract)
We are looking for representatives of this HTML5 API to discuss of potentially needed updates to consider server-side implementations
- Note that the asynchronous APIs are meant to be available either in the main thread and in workers (via WorkerUtils). It is mainly mandatory in Shared Worker but can also make sense, at least in the browser, in dedicated Workers. Synchronous SSJS implementations should probably provide such APIs even if they block the execution until the callback can be called.