Constructor
new Wasi(env)
Create a Wasi class
Parameters:
Name | Type | Description |
---|---|---|
env |
Object.<string, string> | The environment variables |
Classes
Members
functionRegistry
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
functionRegistry |
FunctionRegistry |
<optional> |
The function registry |
instance
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
instance |
WebAssembly.Instance |
<optional> |
The WebAssembly instance. |
memoryManager
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
memoryManager |
MemoryManager |
<optional> |
The WebAssembly memory manager |
Methods
environ_get(environ, environBuf)
Get the environment variables.
Parameters:
Name | Type | Description |
---|---|---|
environ |
number | The environment |
environBuf |
number | The address of the buffer |
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 |
fd_close(fd)
Open the file descriptor
Parameters:
Name | Type | Description |
---|---|---|
fd |
number | The file descriptor |
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 |
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 |
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 |
init(instance)
Initialize the WASI class with a WebAssembly instance.
Parameters:
Name | Type | Description |
---|---|---|
instance |
WebAssembly.Instance | A WebAssembly instance |
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 |
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 |
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 |
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 |
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 |