包详细信息

is-root

sindresorhus22.1mMIT3.0.0

Check if the process is running as root user, for example, one started with sudo

sudo, root, user, permissions

自述文件

is-root

Check if the process is running as root user, for example, one started with sudo

Install

$ npm install is-root

Usage

$ sudo node index.js
// index.js
import isRoot from 'is-root';

isRoot();
//=> true

Related

  • is-elevated - Check if the process is running with elevated privileges (cross-platform)