NodeWorker.Options class
Options for configuring a NodeWorker
.
C#
public class Options
Public Members
name | description |
---|---|
Options() | The default constructor. |
Argv { get; set; } | List of arguments which would be stringified and appended to Argv in the worker. This is mostly similar to the WorkerData but the values are available on the global Argv as if they were passed as CLI options to the script. |
Env { get; set; } | If set, specifies the initial value of Env inside the Worker thread. Default: parent thread env. |
Eval { get; set; } | If true, interpret the first argument to the constructor as a script that is executed once the worker is online. Otherwise the first argument to the constructor must be a file path to the script. |
ExecArgv { get; set; } | List of node CLI options passed to the worker. V8 options and options that affect the process are not supported. If set, this is provided as process.execArgv inside the worker. By default, options are inherited from the parent thread. |
Name { get; set; } | An optional name to be appended to the worker title for debugging/identification purposes. |
ResourceLimits { get; set; } | An optional set of resource limits for the new JS engine instance. Reaching these limits leads to termination of the Worker instance. These limits only affect the JS engine, and no external data, including no ArrayBuffers. Even if these limits are set, the process may still abort if it encounters a global out-of-memory situation. |
ShareEnv { get; set; } | Specifies that the parent thread and the child thread should share their environment variables; in that case, changes to one thread's Env object affect the other thread as well. |
Stderr { get; set; } | If this is set to true, then Stderr is not automatically piped through to StdErr in the parent. |
Stdin { get; set; } | If this is set to true, then Stdin provides a writable stream whose contents appear as Stdin inside the Worker. By default, no data is provided. |
Stdout { get; set; } | If this is set to true, then Stdout is not automatically piped through to Stdout in the parent. |
TrackUnmanagedFds { get; set; } | If this is set to true, then the Worker tracks raw file descriptors managed through fs.open() and fs.close() , and closes them when the Worker exits, similar to other resources like network sockets or file descriptors managed through the FileHandle API. This option is automatically inherited by all nested Workers. Default: true. |
WorkerData { get; set; } | Any JavaScript value that is cloned and made available as CurrentWorkerData . The cloning occurs as described in the HTML structured clone algorithm, and an error is thrown if the object cannot be cloned (e.g. because it contains functions). |
See Also
- class NodeWorker
- namespace Microsoft.JavaScript.NodeApi.Interop