Interface Wasm
interface Wasm {
detectWasiRequirements(wasmBytes: Uint8Array): Promise<boolean>;
loadEmscripten(path: string): Promise<void>;
loadWasiComponent(
path: string,
streams: WasiStreamOptions,
args?: string[],
shell?: Shell,
pid?: number,
): Promise<WasiComponentResult>;
loadWasm(path: string): Promise<{ instance: Instance; module: Module }>;
}
detectWasiRequirements(wasmBytes: Uint8Array): Promise<boolean>;
loadEmscripten(path: string): Promise<void>;
loadWasiComponent(
path: string,
streams: WasiStreamOptions,
args?: string[],
shell?: Shell,
pid?: number,
): Promise<WasiComponentResult>;
loadWasm(path: string): Promise<{ instance: Instance; module: Module }>;
}
Methods
detectWasiRequirements
- detectWasiRequirements(wasmBytes: Uint8Array): Promise<boolean>
Detect if a WASM module requires WASI bindings
Parameters
- wasmBytes: Uint8Array
The WASM module bytes
Returns Promise<boolean>
True if WASI is required, false otherwise
- wasmBytes: Uint8Array
loadEmscripten
loadWasiComponent
- loadWasiComponent(
path: string,
streams: WasiStreamOptions,
args?: string[],
shell?: Shell,
pid?: number,
): Promise<WasiComponentResult> Load a WASI component with stream integration
Parameters
- path: string
Path to the WASM file
- streams: WasiStreamOptions
Stream options for stdin/stdout/stderr
Optionalargs: string[]Command line arguments
Optionalshell: ShellOptional shell instance to use for environment variables
Optionalpid: numberOptional process ID for the WASM execution context
Returns Promise<WasiComponentResult>
The WASM instance and exit code promise
- path: string
Interface for WebAssembly management functionality