ordered-read-streams
Advanced tools
Weekly downloads
Changelog
2.0.0 (2022-10-10)
Readme
Combines array of streams into one Readable stream in strict order.
var { Readable } = require('streamx');
var ordered = require('ordered-read-streams');
var s1 = new Readable({
read: function (cb) {
var self = this;
if (self.called) {
self.push(null);
return cb(null);
}
setTimeout(function () {
self.called = true;
self.push('stream 1');
cb(null);
}, 200);
},
});
var s2 = new Readable({
read: function (cb) {
var self = this;
if (self.called) {
self.push(null);
return cb(null);
}
setTimeout(function () {
self.called = true;
self.push('stream 2');
cb(null);
}, 30);
},
});
var s3 = new Readable({
read: function (cb) {
var self = this;
if (self.called) {
self.push(null);
return cb(null);
}
setTimeout(function () {
self.called = true;
self.push('stream 3');
cb(null);
}, 100);
},
});
var readable = ordered([s1, s2, s3]);
readable.on('data', function (data) {
console.log(data);
// Logs:
// stream 1
// stream 2
// stream 3
});
ordered(streams, [options])
Takes an array of Readable
streams and produces a single OrderedReadable
stream that will consume the provided streams in strict order. The produced Readable
stream respects backpressure on itself and any provided streams.
orderedReadable.addSource(stream)
The returned Readable
stream has an addSource
instance function that takes appends a Readable
stream to the list of source streams that the OrderedReadable
is reading from.
MIT
FAQs
Combines array of streams into one Readable stream in strict order.
The npm package ordered-read-streams receives a total of 1,838,014 weekly downloads. As such, ordered-read-streams popularity was classified as popular.
We found that ordered-read-streams demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.