package
Concatenate a series of streams 'end-to-end'.
npm install next-streamGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 14 packages.
953.0 kB
Includes dependencies.
3 direct · 2 outdated
Concatenate/attach a series of streams a,b,c,... "end-to-end", so that the
result streams from a until it ends, then moves on to b till it ends, etc.
If you don't need mutation, laziness, or non-streams, you should probably just use stream-cat.
Supports:
push(stream).var next = require('next-stream');
var stream1 = fs.createReadStream('file1.txt'),
stream2 = fs.createReadStream('file2.txt'),
joined = next([stream1, stream2]);
joined.push(fs.createReadStream('file3.txt'));
joined.close(); // tell `joined` to emit `end` when the last stream ends.
joined.pipe(process.stdout);Outputs contents of file1.txt followed by contents of file2.txt and then
the contents of file3.txt.
For convenience, non-stream inputs also work as you'd expect:
var next = require('next-stream');
var stream1 = fs.createReadStream('file1.txt'),
stream2 = fs.createReadStream('file2.txt'),
joined = next([stream1, '--------- between ---------', stream2]);
joined.pipe(process.stdout);Outputs contents of file1.txt, followed by '--------- between ---------',
followed by contents of file2.txt.
Create a new readable next-stream from the readable streams stream1,
stream2, stream3.
By default, joined is in open-ended mode, which means it
won't emit 'end' when the last stream in the list ends. Setting opts.open
to false causes joined to end when the last stream ends.
Add stream4 to the end of the list of streams.
Close joined if it is in open-ended mode.
'next'Emitted when we've hit the end event of the current stream. Event payload is the next stream, or null if there are none.