Returns the file system that the path points to.
Create the file at path p with the given mode. Then, open it with the given flag.
Mounts the file system at the given mount point.
Opens the file at path p with the given flag. The file must exist.
The path to open.
The flag to use when opening the file.
Creates a MountableFileSystem instance with the given options.
Generated using TypeDoc
The MountableFileSystem allows you to mount multiple backend types or multiple instantiations of the same backend into a single file system tree. The file systems do not need to know about each other; all interactions are automatically facilitated through this interface.
For example, if a file system is mounted at /mnt/blah, and a request came in for /mnt/blah/foo.txt, the file system would see a request for /foo.txt.
You can mount file systems when you configure the file system:
BrowserFS.configure({ fs: "MountableFileSystem", options: { '/data': { fs: 'HTTPRequest', options: { index: "http://mysite.com/files/index.json" } }, '/home': { fs: 'LocalStorage' } } }, function(e) { });
For advanced users, you can also mount file systems after MFS is constructed:
BrowserFS.FileSystem.HTTPRequest.Create({ index: "http://mysite.com/files/index.json" }, function(e, xhrfs) { BrowserFS.FileSystem.MountableFileSystem.Create({ '/data': xhrfs }, function(e, mfs) { BrowserFS.initialize(mfs); // Added after-the-fact... BrowserFS.FileSystem.LocalStorage.Create(function(e, lsfs) { mfs.mount('/home', lsfs); }); }); });
Since MountableFileSystem simply proxies requests to mounted file systems, it supports all of the operations that the mounted file systems support.
With no mounted file systems,
MountableFileSystem
acts as a simpleInMemory
filesystem.