當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Node.js process.getuid()用法及代碼示例

process.getuid()

添加於:v0.1.28

process.getuid() 方法返回進程的數字用戶身份。 (參見 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()}`);
}

此函數僅適用於 POSIX 平台(即不是 Windows 或 Android)。

相關用法


注:本文由純淨天空篩選整理自nodejs.org大神的英文原創作品 process.getuid()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。