pull-many
combine many pull-stream sources into one
Last updated 9 years ago by dominictarr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install pull-many 
SYNC missed versions from official npm registry.

pull-many

Combine many streams into one stream, as they come, while respecting back pressure.

A chunk is read from each stream, and the next available chunk is selected in a round-robbin.

If a any stream errors, then all the remaining streams are aborted, and then the sink is passed the error. If you want instead to drop the erroring stream, and continue reading from the other streams, you should pipe each stream through a stream that handles the error(ignores, logs, whatever) and then ends normally.

Example


var pull = require('pull-stream')
var many = require('pull-many')

pull(
  many([
    pull.values([1,2,3]),
    pull.values([1,3,5]),
    pull.values([2,4,6])
  ]),
  pull.collect(function (err, ary) {
    if(err) throw err
    console.log(ary)
    //=> [1, 1, 2, 2, 3, 4, 3, 5, 6]
  })
)

// add streams later too
var m = many()

pull(
  m,
  pull.collect(function (err, ary) {
    if(err) throw err
    console.log(ary)
    //=> [1,2,3,4,5,6]
  })
)

m.add(pull.values([1,2,3]))
m.add(pull.values([4,5,6]))

License

MIT

Current Tags

  • 1.0.9                                ...           latest (5 years ago)

9 Versions

  • 1.0.9                                ...           5 years ago
  • 1.0.8                                ...           8 years ago
  • 1.0.7                                ...           8 years ago
  • 1.0.6                                ...           9 years ago
  • 1.0.5                                ...           10 years ago
  • 1.0.4                                ...           10 years ago
  • 1.0.3                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 4
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE