Node.js での実行例
node \
--experimental-wasi-unstable-preview1 \
--experimental-wasm-return_call \
run.mjs
import { readFile } from "fs/promises";
import { argv, env } from "process";
import { WASI } from "wasi";
const wasi = new WASI({
args: argv,
env,
preopens: { "/": process.env.PWD },
});
wasi.start(
await WebAssembly.instantiate(
await WebAssembly.compile(await readFile("./app.wasm")),
{ wasi_snapshot_preview1: wasi.wasiImport },
),
);