Open walmartwarlord opened 10 months ago
Hi! Thanks for this. I'm looking at the wasi-js example, and wondering where can get the value of wasmOpts here?
wasmOpts
import { WASI } from "wasi-js"; import fs from "fs"; import nodeBindings from "wasi-js/dist/bindings/node"; const wasi = new WASI({ args: [], env: {}, bindings: {...nodeBindings, fs}, }); const source = await readFile(pathToWasm); const typedArray = new Uint8Array(source); const result = await WebAssembly.instantiate(typedArray, wasmOpts); // where can we wasmOpts wasi.start(result.instance);
I tried looking at the WASI implementation of node 20 and tried to do it as well - but it is undefined:
const result = await WebAssembly.instantiate(typedArray, wasi.getImportObject()); // getImportObject is undefined
Any tips? Thank you!
I don't have time at the moment to look into this, but I would start by looking first at
https://github.com/sagemathinc/cowasm/blob/28cf78ae7d96373a49f026ffd02813dcf0c9dd17/core/wasi-js/src/runtime.ts#L77
Hi! Thanks for this. I'm looking at the wasi-js example, and wondering where can get the value of
wasmOpts
here?I tried looking at the WASI implementation of node 20 and tried to do it as well - but it is undefined:
Any tips? Thank you!