New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pull-switch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pull-switch

split a pull-stream into many streams

latest
Source
npmnpm
Version
3.0.1
Version published
Maintainers
1
Created
Source

pull-switch

split a pull-stream into many substreams

var pull = require('pull-stream')
var pswitch = require('pull-switch')

  pull(
    pull.count(100),
    pswitch(function select (e) {
      // return key for which stream this is directed to.
      return e % 2 ? 'even' : 'odd'
    }, function createStream(key) { // 'even' or 'odd'
      //return a stream that will be piped to...
      return pull.drain(function (d) {
        console.log(key+'>', d)
      })
    })
  )

has the same api as pull-fork but reads the source at full power instead of trying to follow backpressure closely. In somecases it's simpler to do this, as waiting (for back-pressure to release) creates the possibility of deadlocks.

License

MIT

FAQs

Package last updated on 09 Jun 2014

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