Class: Wasi

Wasi(env)

An implementation of WASI which supports the minimum required to memory allocation, stdio and multi byte (UTF-8) characters.

Constructor

new Wasi(env)

Create a Wasi class

Parameters:
Name Type Description
env Object.<string, string>

The environment variables

Source:

Classes

Wasi

Members

functionRegistry

Properties:
Name Type Attributes Description
functionRegistry FunctionRegistry <optional>

The function registry

Source:

instance

Properties:
Name Type Attributes Description
instance WebAssembly.Instance <optional>

The WebAssembly instance.

Source:

memoryManager

Properties:
Name Type Attributes Description
memoryManager MemoryManager <optional>

The WebAssembly memory manager

Source:

Methods

environ_get(environ, environBuf)

Get the environment variables.

Parameters:
Name Type Description
environ number

The environment

environBuf number

The address of the buffer

Source:

environ_sizes_get(environCount, environBufSize)

Get the size required to store the environment variables.

Parameters:
Name Type Description
environCount number

The number of environment variables

environBufSize number

The size of the environment variables buffer

Source:

fd_close(fd)

Open the file descriptor

Parameters:
Name Type Description
fd number

The file descriptor

Source:

fd_fdstat_get(fd, stat)

Get the status of a file descriptor

Parameters:
Name Type Description
fd number

The file descriptor

stat number

The status

Source:

fd_seek(fd, offset_low, offset_high, whence, newOffset)

Seek

Parameters:
Name Type Description
fd number

The file descriptor

offset_low number

The low offset

offset_high number

The high offset

whence number

Whence

newOffset number

The new offset

Source:

fd_write(fd, iovs, iovsLen, nwritten)

Write to a file descriptor

Parameters:
Name Type Description
fd number

The file descriptor

iovs number

The address of the scatter vector

iovsLen number

The length of the scatter vector

nwritten number

The number of items written

Source:

init(instance)

Initialize the WASI class with a WebAssembly instance.

Parameters:
Name Type Description
instance WebAssembly.Instance

A WebAssembly instance

Source:

invoke(name, …values) → {*}

Invoke a function with defaults

Parameters:
Name Type Attributes Description
name string | symbol

The function name

values any <repeatable>

The function values

Source:
Returns:
Type
*

invokeExplicitFunction(name, values, mangledArgs) → {*}

Invoke a function given an explicit argument mangle

Parameters:
Name Type Description
name string | symbol

The function name

values Array.<any>

The values with which to call the function

mangledArgs string

The mangled arguments

Source:
Returns:

The return value if any

Type
*

invokeImpliedFunction(name, values, options) → {*}

Invoke a function implied by the arguments

Parameters:
Name Type Description
name string | symbol

The function name

values Array.<any>

The values with which to call the function

options object

Name mangling options

Source:
Returns:

The return value if any

Type
*

proc_exit(rval)

This gets called on exit to stop the running program. We don't have anything to stop!

Parameters:
Name Type Description
rval number

The return value

Source:

registerFunction(name, prototype, callback)

Register a function

Parameters:
Name Type Description
name string | symbol

The function name

prototype FunctionPrototype

The function prototype

callback wasmCallback

The wasm callback

Source: