@irori/idbfs
v0.2.0
Published
Library for accessing Emscripten IDBFS
Downloads
3
Readme
idbfs
This library provides access to the Emscripten file system, including IDBFS. It can be used to manipulate the contents of IDBFS stored by other Emscripten apps.
Usage
This is nothing more than an empty Emscripten program compiled with IDBFS enabled, so you can use the Emscripten file system API on it.
Example
The following example reads data.txt
in an IDBFS mounted on /idbfs
.
const idbfsModule = await import('https://unpkg.com/@irori/idbfs/idbfs.js');
const idbfs = await idbfsModule.default();
idbfs.FS.mkdir('/idbfs');
idbfs.FS.mount(idbfs.IDBFS, {}, '/idbfs');
idbfs.FS.syncfs(true, (err) => {
if (err) throw err;
console.log(idbfs.FS.readFile('/idbfs/data.txt', { encoding: 'utf8' }));
});