Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup CJS example
  • Loading branch information
guybedford authored Aug 28, 2021
commit 5f14a5c7346237cd8311ddf053e4c8972f83c0b1
3 changes: 2 additions & 1 deletion doc/api/wasi.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ wasi.start(instance);
const { readFile } = require('fs/promises');
const { WASI } = require('wasi');
const { argv, env } = require('process');
const { resolve } = require('path');
Comment thread
guybedford marked this conversation as resolved.
Outdated

const wasi = new WASI({
args: argv,
Expand All @@ -55,7 +56,7 @@ const importObject = { wasi_snapshot_preview1: wasi.wasiImport };

(async () => {
const wasm = await WebAssembly.compile(
await readFile(new URL('./demo.wasm', import.meta.url))
await readFile(resolve(__dirname, './demo.wasm'))
Comment thread
guybedford marked this conversation as resolved.
Outdated
);
const instance = await WebAssembly.instantiate(wasm, importObject);

Expand Down