@wasmer/wasi
The Package for using WASI easily from Node and the Browser
WASI
import { WASI } from "@wasmer/wasi"
Constructor
new WASI(wasiConfigObject): WASI
Constructs a new WASI instance.
The wasiConfigObject
is is as follows:
This returns a WASI instance. Please see the Instance properties section to learn about the WASI instance.
Class Properties
Instance Properties
memory
wasiInstance.memory: WebAssembly.Memory
WebAssembly.memory
object, that is a view into the Wasm Module's linear memory.
view
wasiInstance.view: DataView
DataView object, that is a view into the Wasm Module's linear memory.
FD_MAP
wasiInstance.FD_MAP: Map<number, File>
Javascript Map, where the key is the file descriptor, and the value is a Javascript File.
exports
wasiInstance.exports: Exports
WASI API to be imported in the importObject on instantiation.
bindings
wasiInstance.bindings: WASIBindings
The bindings for common node like objects, such as fs
for filesystem, these should work by default, but are applied depending on the platform. You can view the source code for your respective platform's bindings here.
start
wasiInstance.start(wasmInstance: WebAssembly.Instance): void
Function that takes in a WASI WebAssembly Instance and starts it.
getImports
wasiInstance.getImports(wasmModule: WebAssembly.Module): Exports
Function that returns the map of corresponding imports for the WASI module. It will throw an error in case the wasmModule
is not a WASI Module, or it have an incompatible version.
Last updated