new WASI([options])
-
options
<Object>-
args
<Array> WebAssembly 应用将视为命令行参数的字符串数组。第一个参数是 WASI 命令本身的虚拟路径。默认值:[]
。¥
args
<Array> An array of strings that the WebAssembly application will see as command-line arguments. The first argument is the virtual path to the WASI command itself. Default:[]
. -
env
<Object> 类似于process.env
的对象,WebAssembly 应用将其视为其环境。默认值:{}
。¥
env
<Object> An object similar toprocess.env
that the WebAssembly application will see as its environment. Default:{}
. -
preopens
<Object> 此对象表示 WebAssembly 应用的沙箱目录结构。preopens
的字符串键被视为沙箱中的目录。preopens
中对应的值是宿主机上这些目录的真实路径。¥
preopens
<Object> This object represents the WebAssembly application's sandbox directory structure. The string keys ofpreopens
are treated as directories within the sandbox. The corresponding values inpreopens
are the real paths to those directories on the host machine. -
returnOnExit
<boolean> 默认情况下,WASI 应用通过__wasi_proc_exit()
函数终止 Node.js 进程。将此选项设置为true
会导致wasi.start()
返回退出代码而不是终止进程。默认值:false
。¥
returnOnExit
<boolean> By default, WASI applications terminate the Node.js process via the__wasi_proc_exit()
function. Setting this option totrue
causeswasi.start()
to return the exit code rather than terminate the process. Default:false
. -
stdin
<integer> 在 WebAssembly 应用中用作标准输入的文件描述符。默认值:0
。¥
stdin
<integer> The file descriptor used as standard input in the WebAssembly application. Default:0
. -
stdout
<integer> 在 WebAssembly 应用中用作标准输出的文件描述符。默认值:1
。¥
stdout
<integer> The file descriptor used as standard output in the WebAssembly application. Default:1
. -
stderr
<integer> 在 WebAssembly 应用中用作标准错误的文件描述符。默认值:2
。¥
stderr
<integer> The file descriptor used as standard error in the WebAssembly application. Default:2
.
-