Introduction
bacon-spawn - spawn child process and create bacon stream
Synopsis
var bacon_spawn =Bacon = ;var bacon_stream = ;
Installation
If you have npm installed, you can simply type:
npm install bacon-spawn
Or you can clone this repository using the git command:
git clone git://github.com/JSBizon/bacon-spawn.git
Usage
Start child process and create Bacon stream:
var bacon_spawn =Bacon = ;var bacon_stream = ;
bacon_stream will produce events objects.
{
type: 'stdout',
data: data,
process: process,
code: code,
signal: signal
sendHandle: sendHandle,
}
Event object properties:
- type - string - the name of event, could be: 'stdout', 'stdin', 'close', 'exit', 'message', 'diconnect' produced by child process.
- data - Buffer - piece of data for 'stdout', 'stdin' and 'message' events
- process - ChildProcess - object of child processes
- code - number - the exit code for 'close' and 'exit' events
- signal - string - the signal passed to kill the child process
- sendHandle - Handle object
You can connect bacon stream how stdin for child process:
var stdin = BACON.sequentially(1,['value1','value2']);
var stream = bacon_spawn(Bacon, 'cat').connect(stdin);
Examples
Read stdout:
var stream = ;stream2
Connect stdout from one process to stdin for other:
var stdin =;var stream = ;