Get the attributes of a file descriptor. Note: This returns similar flags to fsync(fd, F_GETFL) in POSIX, as well as additional fields.
Returns fdstat - the buffer where the file descriptor's attributes are stored.
Result<fdstat, errno>
Read directory entries from a directory. When successful, the contents of the output buffer consist of a sequence of directory entries. Each directory entry consists of a dirent object, followed by dirent::d_namlen bytes holding the name of the directory entry. This function fills the output buffer as much as possible, potentially truncating the last directory entry. This allows the caller to grow its read buffer size in case it's too small to fit a single large directory entry, or skip the oversized directory entry.
Atomically replace a file descriptor by renumbering another file descriptor. Due to the strong focus on thread safety, this environment does not provide a mechanism to duplicate or renumber a file descriptor to an arbitrary number, like dup2(). This would be prone to race conditions, as an actual file descriptor with the same number could be allocated by a different thread at the same time. This function provides a way to atomically renumber file descriptors, which would disappear if dup2() were to be removed entirely.
Move the offset of a file descriptor.
The offset is specified as a bigint here Note: This is similar to lseek in POSIX.
The offset, and return type are FileSize (u64) which is represented by bigint in JavaScript.
Optional
debug: DebugFnInitialize a WASI Reactor.
See: https://github.com/WebAssembly/WASI/blob/main/legacy/application-abi.md
Optional
memory?: MemoryOpen a file or directory. The returned file descriptor is not guaranteed to be the lowest-numbered file descriptor not currently open; it is randomized to prevent applications from depending on making assumptions about indexes, since this is error-prone in multi-threaded contexts. The returned file descriptor is guaranteed to be less than 2**31. Note: This is similar to openat in POSIX.
Rename a file or directory. Note: This is similar to renameat in POSIX.
Write high-quality random data into a buffer. This function blocks when the implementation is unable to immediately provide sufficient high-quality random data. This function may execute slowly, so when large mounts of random data are required, it's advisable to use this function to seed a pseudo-random number generator, rather than to provide the random data directly.
Return the attributes of an open file.
Return the attributes of a file or directory. Note: This is similar to stat in POSIX.
Start a WASI command.
See: https://github.com/WebAssembly/WASI/blob/main/legacy/application-abi.md
Optional
memory?: MemoryStatic
initializeInitialize a WASI reactor.
Returns the WebAssembly instance exports.
Static
startStart a WASI command.
Generated using TypeDoc
Implementation of a WASI runner for the browser. Explicitly designed for the browser context, where system resources must all be emulated. This WASI implementation relies on configuration and callbacks to decide on what system resources are available and defaults to providing none.
This implementation adapted from cloudflare/workers-wasi https://github.com/cloudflare/workers-wasi/blob/main/src/index.ts