property Process.allowedNodeEnvironmentFlags
The process.allowedNodeEnvironmentFlags property is a special,
read-only Set of flags allowable within the NODE_OPTIONS environment variable.
process.allowedNodeEnvironmentFlags extends Set, but overrides Set.prototype.has to recognize several different possible flag
representations. process.allowedNodeEnvironmentFlags.has() will
return true in the following cases:
- Flags may omit leading single (
-) or double (--) dashes; e.g.,inspect-brkfor--inspect-brk, orrfor-r. - Flags passed through to V8 (as listed in
--v8-options) may replace one or more non-leading dashes for an underscore, or vice-versa; e.g.,--perf_basic_prof,--perf-basic-prof,--perf_basic-prof, etc. - Flags may contain one or more equals (
=) characters; all characters after and including the first equals will be ignored; e.g.,--stack-trace-limit=100. - Flags must be allowable within
NODE_OPTIONS.
When iterating over process.allowedNodeEnvironmentFlags, flags will
appear only once; each will begin with one or more dashes. Flags
passed through to V8 will contain underscores instead of non-leading
dashes:
import { allowedNodeEnvironmentFlags } from 'node:process';
allowedNodeEnvironmentFlags.forEach((flag) => {
// -r
// --inspect-brk
// --abort_on_uncaught_exception
// ...
});
The methods add(), clear(), and delete() ofprocess.allowedNodeEnvironmentFlags do nothing, and will fail
silently.
If Node.js was compiled without NODE_OPTIONS support (shown in config), process.allowedNodeEnvironmentFlags will
contain what would have been allowable.
Type #
ReadonlySet<string>