Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jcblw/stream-line-dispatch
A way to read lines from a stream and dispatch events based off of pattern matching of those strings.
https://github.com/jcblw/stream-line-dispatch
Last synced: 16 days ago
JSON representation
A way to read lines from a stream and dispatch events based off of pattern matching of those strings.
- Host: GitHub
- URL: https://github.com/jcblw/stream-line-dispatch
- Owner: jcblw
- License: mit
- Created: 2014-10-12T19:47:15.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-12T14:16:57.000Z (over 7 years ago)
- Last Synced: 2024-04-23T01:43:05.560Z (7 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
```javascript
var
spawn = require( 'child_process' ).spawn,
sld = require( 'stream-line-dispatch' ),
ssh = spawn( 'ssh', [ '-i', '~/.ssh/bar', '-tt', '[email protected]' ] ),
transform = sld( {
output: process.stdout, // optional writable stream
sendOutput: true // flag if to write to stream
});transform.on( '#$', function() { // terminal char aka ready for input
ssh.stdin.write( 'exit \n' );
});ssh.stdout.pipe( transform );
```