js-wasm-tools
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "js-wasm-tools", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Dominic Elm", | ||
@@ -5,0 +5,0 @@ "description": "JavaScript version of wasm-tools, low level tooling for WebAssembly in Rust", |
@@ -5,4 +5,2 @@ # js-wasm-tools | ||
This package is meant to be used on the Web. | ||
## Install | ||
@@ -14,2 +12,6 @@ | ||
## Playground | ||
You can try it out live on [StackBlitz.com](https://stackblitz.com/edit/js-wasm-tools?file=index.js). | ||
## Usage | ||
@@ -30,2 +32,23 @@ | ||
With Node.js: | ||
```js | ||
import initWasmTools, * as wasmTools from 'js-wasm-tools'; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import * as url from 'url'; | ||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); | ||
const bytes = fs.readFileSync(path.join(__dirname, 'node_modules/js-wasm-tools/dist/js_wasm_tools_bg.wasm')); | ||
await initWasmTools(bytes); | ||
const source = '(module)'; | ||
const binary = wasmTools.parseWat(source); | ||
console.log(binary); | ||
``` | ||
## API | ||
@@ -32,0 +55,0 @@ |
1274226
165