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
// Node.js program to demonstrate the // Process.allowedNodeEnvironmentFlags Property // Importing process module const process = require( 'process' );
// Getting NodeEnvironmentFlags const flags = process.allowedNodeEnvironmentFlags; // Display the total size console.log(flags.size) |
Run the index.js file using the following command:
node index.js
Output:
104
Example 2:
index.js
// Node.js program to demonstrate the // Process.allowedNodeEnvironmentFlags Property // Importing process module const process = require( 'process' );
// Getting NodeEnvironmentFlags process.allowedNodeEnvironmentFlags.forEach((flag) => { // Display the length for each
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: