@wasmer/wasi
The Package for using WASI easily from Node and the Browser
WASI
Constructor
const browserBindings = require("@wasmer/wasi/lib/bindings/browser");
// for Node:
// const nodeBindings = require("@wasmer/wasi/lib/bindings/node");
let myWASIInstance = new WASI({
// OPTIONAL: The pre-opened dirctories
preopenDirectories: {},
// OPTIONAL: The environment vars
env: {},
// OPTIONAL: The arguments provided
args: [],
// OPTIONAL: The environment bindings (fs, path),
// useful for using WASI in diferent environments
// such as Node.js, Browsers, ...
bindings: {
// hrtime: (time?: [number, number]) -> number
// exit: (code?: number) -> void
// kill: (pid: number, signal?: string | number) -> void
// randomFillSync: (buffer: Buffer, offset?: number, size?: number) -> Buffer
// isTTY: () -> bool
// fs: Filesystem (with similar API interface as Node 'fs' module)
// path: Path (with similar API Interface as Node 'path' module)
...browserBindings // Use `nodeBindings` for Node
}
});Class Properties
Instance Properties
memory
view
FD_MAP
exports
bindings
start
getImports
Last updated