process.getuid()


process.getuid() 方法返回进程的数字用户标识。 (见 getuid(2)。)

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

此功能仅适用于 POSIX 平台(即不适用于 Windows 或安卓)。

The process.getuid() method returns the numeric user identity of the process. (See getuid(2).)

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

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