@jsdevtools/ez-spawn

Spawn child processes synchronously or asynchronously with simple, consistent API.

npmmacoslinuxwindows
Try with needOr install directly
Source

About

Simple, consistent sync or async process spawning

Examples

run a command and wait for it to finish$ const spawn = require('@jsdevtools/ez-spawn'); const result = spawn.sync('ls', ['-la']);
execute a program and capture output$ const spawn = require('@jsdevtools/ez-spawn'); const result = spawn.sync('npm', ['list']); console.log(result.stdout);
run a process asynchronously with a callback$ const spawn = require('@jsdevtools/ez-spawn'); spawn('npm', ['install'], (error, result) => { if (!error) console.log(result.stdout); });
spawn a process and handle errors$ const spawn = require('@jsdevtools/ez-spawn'); spawn.sync('git', ['clone', 'repo.git']).then(result => console.log('done')).catch(err => console.error(err));
run shell commands from node code$ const spawn = require('@jsdevtools/ez-spawn'); const result = spawn.sync('sh', ['-c', 'echo hello && date']);