elevated
v1.1.5
Published
Check if script is executed in an elevated mode : with sudo on Linux and from an administrator account on Windows.
Downloads
21
Maintainers
Readme
elevated
Check if script is executed in an elevated mode :
- Using SUDO on Linux.
- From an administrator account on Windows.
No support for other platforms like MacOS with this version but I'm opened to pull requests.
Installation
NPM
npm install -s elevated
Yarn
yarn add elevated
Usage examples
elevated.check()
console.log(
require('elevated').check() ? 'elevated' : 'unelevated'
);
elevated.required()
This way an exception is thrown with a platform specific message if the runtime is not elevated.
require('elevated').required();