@jsonxr/filesystem
v1.0.1
Published
Universal js library for reading/writing files. In the browser, the read/write is to the indexdb system. In node, it is to the file system.
Readme
js-filesystem
Universal js library for reading/writing files.
https://web.dev/storage-for-the-web/
Node
In node, it uses the fs package to read/write.
Browser
The default behavior of the implementation uses the best option available to the browser. The order of preference is as follows:
- File and Entries API
- IndexedDB
- LocalStorage
Errors
Both IndexedDB and the Cache API both throw a DOMError named QuotaExceededError when you've exceeded the quota available.
Options
Supported
The following web API was chosen to support a generic browser FileSystem.
|Feature|Firefox|Chrome|Edge|Safari|IE| |---|---|---|---|---|---| |IndexedDB|yes|yes|yes|yes|no|
Rejected
The following APIs were all considered in choosing a backend to support
|Rejected APIs|Reason| |---|---| |File and Entries API|Requires permission for each request| |Cache|Requires a request URL| |SessionStorage|Limited storage| |LocalStorage|Limited storage| |Cookies|really?| |File System Access API|Chromium only| |WebSQL|deprecated| |Application Cache|deprecated|
