Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasi-js getImportObject #68

Open
targetlucked69 opened this issue Sep 9, 2023 · 1 comment
Open

wasi-js getImportObject #68

targetlucked69 opened this issue Sep 9, 2023 · 1 comment

Comments

@targetlucked69
Copy link

Hi! Thanks for this. I'm looking at the wasi-js example, and wondering where can get the value of wasmOpts here?

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!

@williamstein
Copy link
Contributor

I don't have time at the moment to look into this, but I would start by looking first at

const result = await WebAssembly.instantiate(typedArray, wasmOpts);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants