Hello I am importing BrowserFS into a another typescript project that also targets Emscripten. I am confused on the Emscripten example from the README:
/**
* Mounts a localStorage-backed file system into the /data folder of Emscripten's file system.
*/
function setupBFS() {
// Grab the BrowserFS Emscripten FS plugin.
var BFS = new BrowserFS.EmscriptenFS();
// Create the folder that we'll turn into a mount point.
FS.createFolder(FS.root, 'data', true, true);
// Mount BFS's root folder into the '/data' folder.
FS.mount(BFS, {root: '/'}, '/data');
}
Where exactly does the FS refrence come from? in:
FS.createFolder(FS.root, 'data', true, true);
// Mount BFS's root folder into the '/data' folder.
FS.mount(BFS, {root: '/'}, '/data');
That implies its some global or polly fill or something. I have thought it might be from BFSRequire and tried this in my code:
const BFS = new BrowserFS.EmscriptenFS();
// Mount the file system into Emscripten.
const FS = BrowserFS.BFSRequire('fs');
FS.mkdir('/emulator');
FS.mount(BFS, {root: '/'}, '/emulator');
That fails because mount is not defined on FS
Furthermore this approach fails as well:
const BFS = new BrowserFS.EmscriptenFS();
// Mount the file system into Emscripten.
BFS.mkdir('/emulator');
BFS.mount(BFS, {root: '/'}, '/emulator');
because mkdir does not exist on BFS. So how do I get this magic FS into my typescript project?
Hello I am importing BrowserFS into a another typescript project that also targets Emscripten. I am confused on the Emscripten example from the README:
Where exactly does the
FS
refrence come from? in:That implies its some global or polly fill or something. I have thought it might be from
BFSRequire
and tried this in my code:That fails because
mount
is not defined onFS
Furthermore this approach fails as well:
because
mkdir
does not exist on BFS. So how do I get this magicFS
into my typescript project?