• groups {integer[]}

    The process.setgroups() method sets the supplementary group IDs for the Node.js process. This is a privileged operation that requires the Node.js process to have root or the CAP_SETGID capability.

    The groups array can contain numeric group IDs, group names, or both.

    1. if (process.getgroups && process.setgroups) {
    2. try {
    3. process.setgroups([501]);
    4. console.log(process.getgroups()); // new groups
    5. } catch (err) {
    6. console.log(`Failed to set groups: ${err}`);
    7. }
    8. }

    This function is only available on POSIX platforms (i.e. not Windows or Android). This feature is not available in [Worker][] threads.