process.getuid()


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

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

import process from 'node:process';

if (process.getuid) {
  console.log(`Current uid: ${process.getuid()}`);
}const process = require('node:process');

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

此功能在 Windows 上不可用。

¥This function not available on Windows.