https://github.com/zen-fs/emscripten
Emscripten backend for ZenFS
https://github.com/zen-fs/emscripten
browserfs zenfs
Last synced: 8 months ago
JSON representation
Emscripten backend for ZenFS
- Host: GitHub
- URL: https://github.com/zen-fs/emscripten
- Owner: zen-fs
- License: mit
- Created: 2024-04-02T20:19:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T14:03:28.000Z (about 2 years ago)
- Last Synced: 2024-05-22T14:05:11.715Z (about 2 years ago)
- Topics: browserfs, zenfs
- Language: TypeScript
- Homepage: https://zen-fs.github.io/emscripten/
- Size: 80.1 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# ZenFS Emscripten Backend
[ZenFS](https://github.com/zen-fs/core) backend for usage with Emscripten.
For more information, see the [docs](https://zen-fs.github.io/emscripten).
Please read the ZenFS core documentation!
## Installing
> [!IMPORTANT]
> This project is licensed under the LGPL (v3+).
```sh
npm install @zenfs/emscripten
```
## Usage
```ts
import { configure, fs } from '@zenfs/core';
import { Emscripten } from '@zenfs/emscripten';
// Note: this assumes you have included Emscripten correctly and have the global `FS` variable available.
await configureSingle({ backend: Emscripten, FS: FS });
if (!fs.existsSync('/test.txt')) {
fs.writeFileSync('/test.txt', 'This is in the Emscripten file system!');
}
const contents = fs.readFileSync('/test.txt', 'utf-8');
console.log(contents);
```