Skip to content

Readable stream that reads from multiple readable streams at the same time

License

Notifications You must be signed in to change notification settings

mafintosh/multi-read-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multi-read-stream

Readable stream that reads from multiple readable streams at the same time. If you are looking for a readable stream that reads sequentially from other streams checkout multistream

npm install multi-read-stream

build status

Usage

var from = require('from2')
var multi = require('multi-read-stream')

var rs = multi.obj([
  from.obj([{hello: 'world'}]),
  from.obj([{hej: 'verden'}])
])

rs.on('data', function (data) {
  console.log(data) // {hello: 'world'} or {hej: 'verden'}
})

rs.on('end', function () {
  console.log('(no more data)')
})

API

stream = multi(arrayOfReadableStreams, [options])

Create a new multi read stream. Options are forwarded to the stream constructor. Other options include:

{
  autoDestroy: true, // destroy the stream if a child stream errors
  end: true // end the stream when all child streams end
}

objStream = multi.obj(arrayOfReadableStreams, [options])

Same as above but sets objectMode = true

stream.add(otherStream)

Add a stream after creating the multi reader

stream.remove(otherStream)

Remove a stream after creating the multi reader

License

MIT

About

Readable stream that reads from multiple readable streams at the same time

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published