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

child-process-ext

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

child-process-ext

Extensions to Node.js child_process module

  • 3.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
535K
decreased by-61.19%
Maintainers
1
Weekly downloads
 
Created

What is child-process-ext?

The child-process-ext package is a Node.js module that extends the core 'child_process' module with additional functionality and convenience methods. It simplifies working with child processes in Node.js by providing enhanced features for spawning, executing, and managing child processes.

What are child-process-ext's main functionalities?

Spawn with Promises

This feature allows you to spawn a child process and work with it using promises, making it easier to handle the asynchronous nature of child process execution. The example shows how to list the contents of the '/usr' directory.

const { spawn } = require('child-process-ext');

async function runCommand() {
  try {
    const result = await spawn('ls', ['-lh', '/usr']);
    console.log(`stdout: ${result.stdout}`);
  } catch (error) {
    console.error(`Error: ${error.message}`);
  }
}

runCommand();

Execute with Enhanced Output Handling

This feature simplifies executing a command and directly handling its output. It enhances the default 'exec' by providing a more straightforward way to access stdout and stderr. The example demonstrates checking the Node.js version installed.

const { exec } = require('child-process-ext');

async function executeCommand() {
  try {
    const { stdout, stderr } = await exec('node -v');
    console.log(`Node Version: ${stdout}`);
  } catch (error) {
    console.error(`Error: ${stderr}`);
  }
}

executeCommand();

Other packages similar to child-process-ext

Keywords

FAQs

Package last updated on 22 Aug 2023

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