Skip to content
Related Articles

Related Articles

Node.js process.getgroups() Method

Improve Article
Save Article
Like Article
  • Last Updated : 12 Oct, 2021

The process.getgroups() method is an inbuilt application programming interface of the Process module which is used to get the supplementary group IDs.



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:

// Allocating process module
const process = require('process');
// Printing  the supplementary group IDs.



Example 2:

// Allocating process module
const process = require('process');
// Checking whether the method exists or not
if (process.getgroups) {
    // Printing getgroups() values
  console.log("The supplementary group IDs :"
               + process.getgroups());


The supplementary group IDs :[0]


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!