npm.io
2.0.3 • Published 6 years ago

metapipe

Licence
LGPL-3.0
Version
2.0.3
Deps
0
Size
15 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

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

Keywords