Skip to content

Commit

Permalink
Fixed readme
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Apr 19, 2024
1 parent b9ca3da commit 2e68537
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,4 @@ npm install @zenfs/emscripten

## Usage

> 🛈 The examples are written in ESM. If you are using CJS, you can `require` the package. If running in a browser you can add a script tag to your HTML pointing to the `browser.min.js` and use ZenFS DOM via the global `ZenFS_Emscripten` object.
You can use DOM backends, though you must register them if you plan on using `configure`:

Main thread:

```js
import { PortFS } from '@zenfs/port';

// Listen for remote file system requests.
PortFS.attachRemoteListener(portObject);
```

Port thread:

```js
import { configure } from '@zenfs/core';
import { Port } from '@zenfs/port';

// Set the remote file system as the root file system.
await configure({
backend: 'PortFS',
port: self,
});
```

```js
import { configure } from '@zenfs/core';
import { Port } from '@zenfs/port';

await configure({ backend: , port: seld );

if (!fs.existsSync('/test.txt')) {
fs.writeFileSync('/test.txt', 'This will persist across reloads!');
}

const contents = fs.readFileSync('/test.txt', 'utf-8');
console.log(contents);
```
> 🛈 The examples are written in ESM. If you are using CJS, you can `require` the package. If running in a browser you can add a script tag to your HTML pointing to the `browser.min.js` and use ZenFS Emscripten via the global `ZenFS_Emscripten` object.

0 comments on commit 2e68537

Please sign in to comment.