Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Nov 25, 2024
1 parent f3fb112 commit 0a71516
Showing 1 changed file with 5 additions and 41 deletions.
46 changes: 5 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,15 @@
# wnfs-utils
# wnfs-utils-web

This library is used with wnfs-android to feed custom blockstore to wnfs-android (from Fula interface)
This library is used with wnfslib-web to use wnfs on the browser.

## Build and Use in TypeScript

1. Build your WebAssembly module:
1. Check the WebAssembly module:

```
wasm-pack build --target web
```

2. edit package name in pkg/package.json. Install the generated package in your Next.js project:
2. Upload to GitHub

```
npm install ../path/to/your/pkg
```

3. Use in your React components:

```
import { WasmPrivateDirectoryHelper } from 'wnfsutils';
import { FFIStore } from 'wnfs-wasm';
function MyComponent() {
useEffect(() => {
async function init() {
// Create FFIStore implementation using wnfs-wasm
const store = new FFIStore();
// Initialize helper
const helper = new WasmPrivateDirectoryHelper(store);
// Use methods
try {
const content = new TextEncoder().encode("Hello WNFS!");
await helper.write_file("/test.txt", content, Date.now());
const readContent = await helper.read_file("/test.txt");
console.log(new TextDecoder().decode(readContent));
} catch (err) {
console.error(err);
}
}
init();
}, []);
return <div>My WNFS Component</div>;
}
```
3. Create a release with the same version as in Cargo.toml

0 comments on commit 0a71516

Please sign in to comment.