Skip to content
Related Articles

Related Articles

Node.js process.allowedNodeEnvironmentFlags Property

View Discussion
Improve Article
Save Article
  • Last Updated : 25 May, 2021

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 lenght 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:

https://nodejs.org/dist/latest-v16.x/docs/api/process.html#process_process_allowednodeenvironmentflags

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!