process.geteuid()


process.geteuid() 方法返回 Node.js 进程的有效数字标记的用户身份(参见 geteuid(2))。

if (process.geteuid) {
  console.log(`当前的 uid: ${process.geteuid()}`);
}

这个函数只在 POSIX 平台有效(在 Windows 或 Android 平台无效)。

The process.geteuid() method returns the numerical effective user identity of the process. (See geteuid(2).)

if (process.geteuid) {
  console.log(`Current uid: ${process.geteuid()}`);
}

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