Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pull-many

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pull-many

combine many pull-stream sources into one

  • 1.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 15 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc