BrowserFS is an in-browser file system that emulates the Node JS file system API and supports storing and retrieving files from various backends. BrowserFS also integrates nicely into the Emscripten file system.
The README provides an overview of how to integrate BrowserFS into your project. This API documentation will focus on how to use BrowserFS once you have added it to your project.
The main BrowserFS interface is documented here.
Before you can use BrowserFS, you must initialize it with a single root file system backend using BrowserFS.initialize
. Think of this as your "storage device".
If you need to use multiple "storage devices", instantiate multiple file system backend types, mount them into a MountableFileSystem
backend, and then use that as the root file system for BrowserFS.
There are all sorts of adapter file systems available to make it easy to access files stored in Emscripten, files stored in a different context (e.g., a web worker), isolate file operations to a particular folder, access asynchronous storage backends synchronously, and more!
Key:
Note that any asynchronous file system can be accessed synchronously using the AsyncMirror file system.
Optional API Support | ||||
---|---|---|---|---|
Backend Name | Read-only? | Synchronous | Properties | Links |
AsyncMirror | ✗ | ✓ | ✗ | ✗ |
Dropbox | ✗ | ✗ | ✗ | ✗ |
Emscripten | ✗ | ✓ | ✓ | ✓ |
FolderAdapter | ? | ? | ? | ✗ |
HTML5FS | ✗ | ✗ | ✗ | ✗ |
IndexedDB | ✗ | ✗ | ✗ | ✗ |
InMemory | ✗ | ✓ | ✗ | ✗ |
IsoFS | ✓ | ✓ | ✗ | ✗ |
LocalStorage | ✗ | ✓ | ✗ | ✗ |
MountableFileSystem | ? | ? | ? | ? |
OverlayFS | ✗ | ? | ? | ✗ |
XmlHttpRequest | ✓ | ✓ | ✗ | ✗ |
WorkerFS | ? | ✗ | ? | ? |
ZipFS | ✓ | ✓ | ✗ | ✗ |
Generated using TypeDoc