easy-spawn

0.0.2 • Public • Published

easy-spawn

Utilities that make it easier to write child_process.spawn programmes.

Features

  • Easy to use
  • Standard callback with err and data

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

Readme

Keywords

none

Package Sidebar

Install

npm i easy-spawn

Weekly Downloads

187

Version

0.0.2

License

MIT

Last publish

Collaborators

  • dong