Package Exports
- match-stream
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (match-stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
match-stream 
Supply a function to handle pattern matches within a NodeJS stream.
Installation
$ npm install match-stream
Quick Example
var MatchStream = require('match-stream');
var streamBuffers = require("stream-buffers");
var ms = new MatchStream({ pattern: 'World'}, function (buf, matched, extra) {
if (!matched) {
return this.push(buf);
}
this.push(buf);
return this.push(null); //end the stream
});
var sourceStream = new streamBuffers.ReadableStreamBuffer();
sourceStream.put("Hello World");
var writableStream = new streamBuffers.WritableStreamBuffer();
sourceStream
.pipe(ms)
.pipe(writableStream)
.once('close', function () {
var str = writableStream.getContentsAsString('utf8');
console.log('Piped data before pattern occurs:', "'" + str + "'");
sourceStream.destroy();
});
//Output
//Piped data before pattern occurs: 'Hello '
License
MIT
Acknowledgements
Special thanks to @wanderview for assisting with the API.