Node.js process.allowedNodeEnvironmentFlags Property
The process.allowedNodeEnvironmentFlags is an inbuilt application programming interface of class Process within the process module which is used to read a set of flags allowable within the NODE_OPTIONS environment variable.
Syntax:
const process.allowedNodeEnvironmentFlags
Parameters: This api takes no argument as a parameter.
Return Value: This api returns a set of flags allowable within the NODE_OPTIONS environment variable.
Example 1:
index.js
const process = require( 'process' );
const flags = process.allowedNodeEnvironmentFlags;
console.log(flags.size)
|
Run the index.js file using the following command:
node index.js
Output:
104
Example 2:
index.js
const process = require( 'process' );
process.allowedNodeEnvironmentFlags.forEach((flag) => {
console.log( "Flag: " , flag, ", Length: " , flag.length)
});
|
Run the index.js file using the following command:
node index.js
Output:
Flag: --icu-data-dir , Length: 14
Flag: --title , Length: 7
..
..
..
..
Flag: --loader , Length: 8
Flag: -r , Length: 2
Reference:
https://nodejs.org/dist/latest-v16.x/docs/api/process.html#process_process_allowednodeenvironmentflags
Last Updated :
18 Jan, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...