We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This works on Node.js with node:wasi:
node:wasi
import { readFile } from 'node:fs/promises'; import { WASI } from 'node:wasi'; import { argv, env } from 'node:process'; const wasi = new WASI({ version: 'preview1', args: [argv[1], '--help'], features: [], env, }); const wasm = await WebAssembly.compile( await readFile(new URL('./dist/bee.wasm', import.meta.url)), ); const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject()); wasi.start(instance);
This doesn't work on Deno, nor Bun:
import { readFile } from 'node:fs/promises' import { useArgs, useEnviron, useStdio, WASI } from 'npm:uwasi' import { argv, env } from 'node:process' const wasi = new WASI({ version: 'preview1', args: [argv[1], '--help'], features: [useEnviron, useArgs, useStdio], env, }) const wasm = await WebAssembly.compile( await readFile(new URL('./dist/bee.wasm', import.meta.url)), ) const instance = await WebAssembly.instantiate(wasm, { wasi_snapshot_preview1: wasi.wasiImport, }) wasi.start(instance)
The error is this:
error: Uncaught (in promise) RangeError: Maximum call stack size exceeded at WASI.wasiImport.<computed> (file:///Users/user/Library/Caches/deno/npm/registry.npmjs.org/uwasi/1.4.1/lib/esm/index.js:1:1) at runtime.fd_write (wasm://wasm/12e425de:1:833563) at runtime.write1 (wasm://wasm/12e425de:1:833910) at runtime.write (wasm://wasm/12e425de:1:1479550) at runtime.writeErrData (wasm://wasm/12e425de:1:1062994) at runtime.badsystemstack (wasm://wasm/12e425de:1:1157894) at runtime.systemstack (wasm://wasm/12e425de:1:1488639) at runtime.throw (wasm://wasm/12e425de:1:1438248) at runtime.write1 (wasm://wasm/12e425de:1:834025) at runtime.write (wasm://wasm/12e425de:1:1479550)
if it's related to permissions (as I see fd_write) - probably it's better to output a nicer error message that makes it clear on what's wrong
fd_write
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This works on Node.js with
node:wasi
:This doesn't work on Deno, nor Bun:
The error is this:
if it's related to permissions (as I see
fd_write
) - probably it's better to output a nicer error message that makes it clear on what's wrongThe text was updated successfully, but these errors were encountered: