easy-spawn
v0.0.2
Published
Utilities that make it easier to write child_process.spawn programmes
Downloads
492
Readme
easy-spawn
Utilities that make it easier to write child_process.spawn programmes.
Features
- Easy to use
- Standard callback with
err
anddata
Usage
Below are some examples of how to work with easy-spawn
, you can find more examples under the /test/
directory
Get file list with ls
var Spawn = require('easy-spawn');
spawn = new Spawn({
cwd: '/working directory where you want to ran command',
});
spawn.cmd('ls', function(err, data) {
console.log(data);
});
spawn.cmd(['ls', '-l', '/var/log'], function(err, data) {
console.log(data);
});
Get your git version
var Spawn = require('easy-spawn');
spawn = new Spawn();
spawn.cmd(['git', '--version'], function(err, data) {
console.log(data); // git version 1.7.xxx
});
Installation
npm install easy-spawn