Node.js process.getgroups() Method
Last Updated :
30 Aug, 2022
The process.getgroups() method is an inbuilt application programming interface of the Process module which is used to get the supplementary group IDs.
Syntax:
process.getgroups()
Parameters: This method does not accept any parameters.
Return: It returns an integer array specifying supplementary group IDs.
Note: This function will only work on POSIX platforms. Not available on windows or android platforms so will cause an error i.e. TypeError, getgroups is not a function.
Below examples illustrate the use of process.getgroups() method in Node.js:
Example 1:
javascript
const process = require( 'process' );
console.log(process.getgroups());
|
Output:
[0]
Example 2:
javascript
const process = require( 'process' );
if (process.getgroups) {
console.log("The supplementary group IDs :"
+ process.getgroups());
}
|
Output:
The supplementary group IDs :[0]
Reference: https://nodejs.org/api/process.html#process_process_getgroups
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...