process.getgid()


process.getgid() 方法返回进程的数值组身份。(参见 getgid(2)。)

【The process.getgid() method returns the numerical group identity of the process. (See getgid(2).)】

import process from 'node:process';

if (process.getgid) {
  console.log(`Current gid: ${process.getgid()}`);
}const process = require('node:process');

if (process.getgid) {
  console.log(`Current gid: ${process.getgid()}`);
}

此功能仅在 POSIX 平台上可用(即不包括 Windows 或 Android)。

【This function is only available on POSIX platforms (i.e. not Windows or Android).】