spawnback

Simplified process spawning with buffered output in a callback.

Usage no npm install needed!

<script type="module">
  import spawnback from 'https://cdn.skypack.dev/spawnback';
</script>

README

spawnback

Simplified process spawning with buffered output in a callback.

Support this project by donating on Gratipay.

Installation

npm install spawnback

Usage

var spawn = require( "spawnback" );
spawn( "git", [ "status" ], function( error, stdout ) {
    console.log( stdout );
});

API

spawnback follows the same API as node's built-in child_process.spawn(), but accepts a callback as the final parameter. The callback receives three paramaters: an error object, stdout as a string, and stderr as a string.

spawnback( command, [args], [options], callback )

  • command String: The command to run.
  • args Array: List of string arguments.
  • options Object: See the node API docs for full details on which options are supported.
  • callback function( error, stdout, stderr ): A callback to invoke when the child process has ended and all stdio streams have terminated.
  • return: ChildProcess instance.

License

Copyright 2014 Scott González. Released under the terms of the MIT license.


Support this project by donating on Gratipay.