@irori/idbfs
v6.0.0
Published
Library for accessing Emscripten IDBFS
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.
Versioning
The version number of this package tracks the version of Emscripten used to
build it. For example, 6.0.0 is built with Emscripten 6.0.0.
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' }));
});