process.getgroups()
- 返回值: 整数数组[]
process.getgroups() 方法返回一个包含补充组 ID 的数组。POSIX 并未明确规定是否包含有效组 ID,但 Node.js 确保它总是被包含。
【The process.getgroups() method returns an array with the supplementary group
IDs. POSIX leaves it unspecified if the effective group ID is included but
Node.js ensures it always is.】
import process from 'node:process';
if (process.getgroups) {
console.log(process.getgroups()); // [ 16, 21, 297 ]
}const process = require('node:process');
if (process.getgroups) {
console.log(process.getgroups()); // [ 16, 21, 297 ]
}此功能仅在 POSIX 平台上可用(即不包括 Windows 或 Android)。
【This function is only available on POSIX platforms (i.e. not Windows or Android).】