Node-Stream
A collection of array-like methods for working with streams.
const nodeStream = require('node-stream');
db.createReadStream()
.pipe(nodeStream.where({ type: 'post', author: 'stezu' }))
.pipe(nodeStream.sort((a, b) => a.id > b.id))
.pipe(nodeStream.take(5))
.pipe(nodeStream.stringify())
.pipe(nodeStream.intersperse('\n'))
.pipe(process.stdout);
Install
You can install using npm:
npm install --save node-stream
You can then require()
node-stream:
const nodeStream = require('node-stream');
Documentation
Documentation can be found at http://stezu.github.io/node-stream/.