stream-bucket

0.1.0 • Public • Published

stream.Bucket

stream.Bucket

Consolidate and collect data from multiple streams:

stream = require('stream')
stream.Bucket = require('stream-bucket')
obladi = require('oblada')

s1 = obladi(1).createReadStream()
s2 = obladi(2).createReadStream()
bucket = new stream.Bucket({ objectMode: true })

s1.pipe(bucket)
s2.pipe(bucket)

bucket.on('end', function(data){
    // both streams' data interleaved
})

// alternatively:

new stream.Bucket()
    .catch(s1)
    .catch(s2)
    .on('end', function(data){
        // ...
    })

For a more complex solution that preserves data order for each piped stream see https://github.com/felixge/node-combined-stream

/stream-bucket/

    Package Sidebar

    Install

    npm i stream-bucket

    Weekly Downloads

    1

    Version

    0.1.0

    License

    MIT (ricardo.mit-license.org)

    Last publish

    Collaborators

    • ricardobeat