wasi_snapshot_preview1 for WebAssembly modules, shaped like Node’s node:wasi. WebAssembly itself is
the standard global (MDN).
Nothing is patched globally. Create a
WASI, pass its imports to WebAssembly.instantiate, then
start() a command or initialize() a reactor.WASI
constructor
A host directory outside
data/ needs the filesystem permission and
must exist.
getImportObject
WebAssembly.instantiate. wasi.wasiImport is the same syscall table on its own,
for merging with your own imports.
start
_start() and returns the exit code (0 when _start returns). Call start() or
initialize() once per WASI.
returnOnExit: false, proc_exit throws an Error with exitCode.
initialize
_start): calls _initialize() if it’s exported. Then call its
exports yourself.
dispose
alive is false afterwards, and using
disposes at the end of the block.
Guest environment
Example
Run a WASI command fromdata/app.wasm.