doc: add example code for process.getgroups()

PR-URL: https://github.com/nodejs/node/pull/35625
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Pooja D.P authored and Beth Griggs committed 2020-12-07 18:01:36 +00:00
1 parent 2c342662e5
commit f6ebd81693
1 file changed
+6
+6
View File
@@ -1340,6 +1340,12 @@ 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.
```js
if (process.getgroups) {
console.log(process.getgroups()); // [ 16, 21, 297 ]
}
```
This function is only available on POSIX platforms (i.e. not Windows or
Android).