lighter-spawn
v1.0.0
Published
A lightweight JavaScript child process spawning utility.
Downloads
2
Maintainers
Readme
lighter-spawn
The lighter-spawn
module is a lightweight child process spawning utility.
Installation
From your project directory, install and save as a dependency:
npm install --save lighter-spawn
API
The API is simply a function which returns a child process.
var spawn = require('lighter-spawn')
// Write file details to the console.
spawn('ls -la')
.on('out', function (files) {
console.log(files)
})
spawn(command[, options])
Spawn a command, and return a child process object. The command is a string, which can include arguments separated by spaces. If you would like to include a space character inside an argument, use a backslash to escape it.
Event: error
Pass an error object if a process exits with a nonzero exit code.
Event: stderr
Pass a concatenated string of stderr stream data.
Event: stdout
Pass a concatenated string of stdout stream data.
Event: err
Pass an array of lines of stderr stream data.
Event: out
Pass an array of lines of stdout stream data.
Examples
For now, please see the tests.