Socket
Book a DemoInstallSign in
Socket

elevator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elevator

Windows UAC elevation that just works

latest
Source
npmnpm
Version
2.2.3
Version published
Maintainers
1
Created
Source

elevator

Windows UAC elevation that just works.

npm version dependencies Build status ![Gitter](https://badges.gitter.im/Join Chat.svg)

Description

This module is a thin wrapper around the awesome elevate.exe utility by kliu, which is a small C open source application with x64 and ia32 support that just works.

This module doesn't make use of NodeJS C/C++ bindings and instead relies on executing the .exe file direcly in a way that is electron friendly even when the application is packaged in an asar archive.

Of course, this means that this NodeJS module is subjected to the Windows versions and architectures such supports. Windows Vista (or newer) is required.

Installation

Install elevator by running:

$ npm install --save elevator

Documentation

elevator.execute(command, [options], callback)

This function will yield an Error containing a code that equals ELEVATE_CANCELLED if the elevation was cancelled by the user.

Kind: static method of elevator
Summary: Execute a command with UAC elevation
Access: public

ParamTypeDefaultDescription
commandArray.<String>command
[options]Object{}options
[options.terminating]BooleanLaunches a terminating command processor; equivalent to "cmd /c command".
[options.persistent]BooleanLaunches a persistent command processor; equivalent to "cmd /k command".
[options.doNotPushdCurrentDirectory]BooleanWhen using -c or -k, do not pushd the current directory before execution.
[options.unicode]BooleanWhen using -c or -k, use Unicode; equivalent to "cmd /u".
[options.hidden]BooleanWhen using -c or -k, start "cmd" in hidden mode.
[options.waitForTermination]BooleanWaits for termination; equivalent to "start /wait command".
callbackfunctioncallback (error, stdout, stderr)

Example

elevator.execute([ 'cmd.exe' ], {
  waitForTermination: true
}, function(error, stdout, stderr) {
  if (error) {
    throw error;
  }

  console.log(stdout);
  console.log(stderr);
});

elevator.executeSync(command, [options]) ⇒ String

This function will throw an Error containing a code that equals ELEVATE_CANCELLED if the elevation was cancelled by the user.

Kind: static method of elevator
Summary: Execute a command with UAC elevation (Sync)
Returns: String - stdout buffer
Access: public

ParamTypeDefaultDescription
commandArray.<String>command
[options]Object{}options
[options.terminating]BooleanLaunches a terminating command processor; equivalent to "cmd /c command".
[options.persistent]BooleanLaunches a persistent command processor; equivalent to "cmd /k command".
[options.doNotPushdCurrentDirectory]BooleanWhen using -c or -k, do not pushd the current directory before execution.
[options.unicode]BooleanWhen using -c or -k, use Unicode; equivalent to "cmd /u".
[options.hidden]BooleanWhen using -c or -k, start "cmd" in hidden mode.
[options.waitForTermination]BooleanWaits for termination; equivalent to "start /wait command".

Example

elevator.executeSync([ 'cmd.exe' ], {
  waitForTermination: true
});

Support

If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.

Tests

Run the test suite by doing:

$ gulp test

Contribute

Before submitting a PR, please make sure that you include tests, and that jshint runs without any warning:

$ gulp lint

License

The project is licensed under the MIT license.

Keywords

windows

FAQs

Package last updated on 20 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts