is-root

Check if the process is running as root user, eg. started with sudo.

is-root

Check if the process is running as root user, eg. started with sudo.

$ npm install --save is-root
$ sudo node index.js
// index.js 
var isRoot = require('is-root');
 
isRoot();
//=> true 

MIT © Sindre Sorhus