wasm-run
Run arbitrary WASM/WASI files
Installation
$ npm install wasm-run -g
Usage
$ wasm-run --help
wasm-run [options] <file> [args..]
Options:
-i, --invoke Function to execute
-t, --timeout Execution timeout (ms)
--trace Trace imported function calls
--gas-limit Gas limit [default: 100000]
--version Show version number
--help Show help
$ wasm-run ./test/fib32.wasm 32
[tracer] Running fib(32)...
[tracer] Result: 2178309
$ wasm-run --invoke=swap_i64 ./test/swap.wat 10 12
[tracer] Converted to binary (256 bytes)
[tracer] Running swap_i64(10,12)...
[tracer] Result: 12,10
$ wasm-run wasi-hello-world.wasm
Hello world!
$ wasm-run --trace wasi-hello-world.wasm
[tracer] wasi_snapshot_preview1!fd_prestat_get 3,65528 => 0
[tracer] wasi_snapshot_preview1!fd_prestat_dir_name 3,70064,2 => 0
[tracer] wasi_snapshot_preview1!fd_prestat_get 4,65528 => 0
[tracer] wasi_snapshot_preview1!fd_prestat_dir_name 4,70064,2 => 0
...
Features
wasm
and wat
files (using Binaryen
)
wasi-snapshot-preview1
apps via --experimental-wasi-unstable-preview1
flag
wasi-unstable
apps (compatibility layer)
i64
args, multi-value
, bulk-memory
, tail-calls
support via experimental flags
☐ Compiled wasm caching (blocked by #1)
☐ WASI API and structures decoding (generate from witx?)
☐ REPL mode