1.0.0 • Published 8 years ago

checkroot v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

checkroot

Check if the current user is root or not

Install

$ npm install --save checkroot

Usage

const checkroot = require('checkroot');

// returns
//   true, if the current user is root
//   false, otherwise
console.log(checkroot());

API

First it tries to get the username from the USER and LOGNAME environment variables. In the rare case when none of these environment variables are set, it falls back to $ id -un on Linux / MacOS and $ whoami on Windows. The result is cached using mem.

checkroot()

Returns true, if the current user is root and false, otherwise.

License

MIT © Sahil Dua