Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including stream-line-dispatch with all npm packages installed. Try it out:

var streamLineDispatch = require("stream-line-dispatch")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

stream-line-dispatch v0.1.1

A way to read lines from a stream and dispatch events based off of pattern matching of those strings.

Stream Line Dispatch

A way to read lines from a stream and dispatch events based off of pattern matching of those strings. Stream Line Dispatch is a stream transform, that does not transform data but analyses the data from a stream and allow for some simple event binding when data comes throught the pipe.

Install

npm install stream-line-dispatch

Usage

Example usage.

var 
spawn = require( 'child_process' ).spawn,
sld = require( 'stream-line-dispatch' ),
ssh = spawn( 'ssh', [ '-i', '~/.ssh/bar', '-tt', 'root@foo.com' ] ),
transform = sld( {
    output: process.stdout, // optional writable stream
    sendOutput: true // flag if to write to stream
});  

transform.on( '#apos;, function() { // terminal char aka ready for input
    ssh.stdin.write( 'exit \n' );
});

ssh.stdout.pipe( transform );
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free