Deprecated; use AsyncMirror.Create() method instead.
Mirrors the synchronous file system into the asynchronous file system.
IMPORTANT: You must call initialize
on the file system before it can be used.
The synchronous file system to mirror the asynchronous file system to.
The asynchronous file system to mirror.
Create the file at path p with the given mode. Then, open it with the given flag.
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.
Constructs and initializes an AsyncMirror file system with the given options.
Generated using TypeDoc
AsyncMirrorFS mirrors a synchronous filesystem into an asynchronous filesystem by:
The two stores will be kept in sync. The most common use-case is to pair a synchronous in-memory filesystem with an asynchronous backing store.
Example: Mirroring an IndexedDB file system to an in memory file system. Now, you can use IndexedDB synchronously.
BrowserFS.configure({ fs: "AsyncMirror", options: { sync: { fs: "InMemory" }, async: { fs: "IndexedDB" } } }, function(e) { // BrowserFS is initialized and ready-to-use! });
Or, alternatively:
BrowserFS.FileSystem.IndexedDB.Create(function(e, idbfs) { BrowserFS.FileSystem.InMemory.Create(function(e, inMemory) { BrowserFS.FileSystem.AsyncMirror({ sync: inMemory, async: idbfs }, function(e, mirrored) { BrowserFS.initialize(mirrored); }); }); });