Skip to main content

Module node_wasi

Module node_wasi 

Source
Expand description

node:wasi module — WASI preview1 implementation via JS IIFE.

Provides the WASI class and wasiSnapshotPreview1 object that enable running WebAssembly modules compiled to the WASI ABI. The implementation uses pure JS to bridge WASI syscalls to the host environment.

§Architecture

Follows the same JS IIFE pattern as node_stream.rs / node_vm.rs:

  • WASI_SOURCE const holds the JS source
  • install() evaluates the IIFE, extracts the returned object, and registers it via cache_builtin(cx, "wasi", ...)

§References

  • Bun upstream: src/js/node/wasi.ts
  • WASI preview1 spec: https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md

Functions§

install