# process
类似 Node.js 的 process 全局的实现。
¥An implementation of a Node.js-like process global.
# 静态成员
¥Static members
const arch: string表示编译二进制文件的 CPU 架构的字符串。
wasm32或wasm64。¥String representing the CPU architecture for which the binary was compiled. Either
wasm32orwasm64.const platform: string表示编译二进制文件的操作系统平台的字符串。总是
wasm。¥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进程正常退出时使用的进程退出代码。默认为
0。¥Process exit code to use when the process exits gracefully. Defaults to
0.function exit(code?: i32): void使用给定的退出代码或
process.exitCode(如果省略)终止进程。¥Terminates the process with either the given exit code, or
process.exitCodeif omitted.const stdin: ReadableStream const stdout: WritableStream const stderr: WritableStream流分别连接到
stdin(fd0)、stdout(fd1) 和stderr(fd2)。¥Streams connected to
stdin(fd0),stdout(fd1) andstderr(fd2) respectively.function time(): i64获取系统当前时间(自 Unix 纪元以来的毫秒数)。
¥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.