Node.js process.getegid() Method

Last Updated : 12 Oct, 2021
The process.getegid() method is an inbuilt application programming interface of the process module which is used to get the numerical effective group identity of the Node.js process. Syntax:
process.getegid()
Parameters: This method does not accept any parameters. Return Value: It returns an object specifying the numerical effective group identity of the Node.js process. Note: This function will only work on POSIX platforms. Not available on windows or android platforms so it will cause an error i.e. TypeError, getegid is not a function. Below examples illustrate the use of process.getegid() method in Node.js: Example 1: javascript
// Node.js program to demonstrate the     
// process.getegid() Method
 
// Include process module
const process = require('process');

// Print the numerical effective group
// identity of the Node.js process
console.log(process.getegid());
Output:
0
Example 2: javascript
// Node.js program to demonstrate the     
// process.getegid() Method
 
// Include process module
const process = require('process');

// Check whether the method exists or not
if (process.getegid) {
  
  // Printing getegid() value
  console.log("The numerical effective group"
        + " identity of the Node.js process:"
        + process.getegid());
}
Output:
The numerical effective group identity of the Node.js process: 0
Note: The above program will compile and run by using the node filename.js command. Reference: https://nodejs.org/api/process.html#process_process_getegid
Comment

Explore