I'd like to expand the tutorial on how to run the wasm file in NodeJS after running it with wasmtime.
Normally you can simply run WebAssembly.instantiate(buf), but here the demo.c contains arguments input.txt and output.txt.
The WebAssembly requires a wasi_unstable object and within that a fd_prestat_get function, but I don't know how it should look like...
index.js
const fs = require('fs');
const buf = fs.readFileSync('./demo.wasm');
(async () => {
const res = await WebAssembly.instantiate(buf, {wasi_unstable: {fd_prestat_get: () => {}}});
console.log(res.instance);
})();
I'd like to expand the tutorial on how to run the wasm file in NodeJS after running it with wasmtime.
Normally you can simply run
WebAssembly.instantiate(buf), but here the demo.c contains arguments input.txt and output.txt.The WebAssembly requires a
wasi_unstableobject and within that afd_prestat_getfunction, but I don't know how it should look like...index.js