jsr icon indicating copy to clipboard operation
jsr copied to clipboard

WASI support

Open JADSN1894 opened this issue 1 year ago • 0 comments

import { WASI } from 'node:wasi';
import { readFile } from "node:fs/promises";

const wasi = new WASI({
  version: "preview1",
  args: ["bin_name"],
  preopens: {
	  "/": "/",
	  ".": ".",
  },
  });
  
  (async () => {
    const wasm = await WebAssembly.compile(await readFile("filename.wasm"));
    
    const instance = new WebAssembly.Instance(wasm, {
	    wasi_snapshot_preview1: wasi.wasiImport,
    });
  wasi.start(instance);
})();

I'm getting this error on CI: ` Unknown built-in "node:" module: wasi``.

Using wastime works fine: wasmtime --dir=/ --dir=. ./target/wasm32-wasi/release/filename.wasm

Any solution?

Thanks.

JADSN1894 avatar Apr 24 '24 13:04 JADSN1894