Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sudo-prompt

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sudo-prompt

Run a command using sudo, prompting the user with an OS dialog if necessary

  • 8.2.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.8M
increased by7.45%
Maintainers
1
Weekly downloads
 
Created

What is sudo-prompt?

The sudo-prompt npm package is used to execute commands with elevated privileges (as the superuser) in a Node.js environment. It provides a way to prompt the user for their password and then run commands with sudo, which is particularly useful for desktop applications that need to perform system-level tasks.

What are sudo-prompt's main functionalities?

Executing a command with elevated privileges

This feature allows you to execute a command with superuser privileges. The 'exec' function takes a command string, an options object (which includes the application name), and a callback function. The callback will receive any errors, the standard output, and the standard error from the command execution.

const sudo = require('sudo-prompt');
const options = {
  name: 'Example'
};
const command = 'echo $USER';
sudo.exec(command, options, function(error, stdout, stderr) {
  if (error) throw error;
  console.log('stdout: ' + stdout);
});

Other packages similar to sudo-prompt

Keywords

FAQs

Package last updated on 12 Dec 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc