2.0.3 • Published 4 years ago
metapipe v2.0.3
MetaPipe
Transform stream composed of transform streams! And how!
Install
Install using Node Package Manager.
npm install metapipe --save
Usage
Create a pipeline, which is just a transform stream. Add additional tranform streams at any time!
const MetaPipe = require('metapipe');
const pipeline = new MetaPipe({ objectMode: true });
// Default is a simple passthrough
pipeline.write({ foo: 'bar' });
pipeline.read(); // { foo: 'bar' }
// Add a transform to the end of the pipeline (can also `prepend`)
pipeline.append(new stream.Transform({
transform: (data, enc, callback) => {
data.bar = 'baz';
callback(null, data);
},
objectMode: true
}));
pipeline.write({ foo: 'bar' });
pipeline.read(); // { foo: 'bar', bar: 'baz' }
License
GNU LESSER GENERAL PUBLIC LICENSE 3.0