# process

An implementation of a Node.js-like process global on top of WASI. Requires a WASI-enabled host and opting into WASI in the entry file with

import "wasi";

# Static members

  • const arch: string

    String representing the CPU architecture for which the binary was compiled. Either wasm32 or wasm64.

  • const platform: string

    String representing the operating system platform for which the binary was compiled. Always wasm.

  • const argv: string[]

    Array of command line arguments passed to the binary upon instantiation.

  • const env: Map<string,string>

    Map of variables in the binary's user environment.

  • var exitCode: i32

    Process exit code to use when the process exits gracefully. Defaults to 0.

  • function exit(code?: i32): void

    Terminates the process with either the given exit code, or process.exitCode if omitted.

  • const stdin: ReadableStream
    const stdout: WritableStream
    const stderr: WritableStream

    Streams connected to stdin (fd 0), stdout (fd 1) and stderr (fd 2) respectively.

  • function time(): i64

    Obtains the system's current time of day, in milliseconds since Unix epoch.

  • function hrtime(): u64

    Obtains the system's monotonic high resolution time, in nanoseconds since an arbitrary time in the past.