process.geteuid()
process.geteuid()
方法返回进程的数字有效用户身份。(请参阅 geteuid(2)
。)
¥The process.geteuid()
method returns the numerical effective user identity of
the process. (See geteuid(2)
.)
import process from 'node:process';
if (process.geteuid) {
console.log(`Current uid: ${process.geteuid()}`);
}
const process = require('node:process');
if (process.geteuid) {
console.log(`Current uid: ${process.geteuid()}`);
}
此功能仅适用于 POSIX 平台(即不适用于 Windows 或安卓)。
¥This function is only available on POSIX platforms (i.e. not Windows or Android).