Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
example.js
index.js
package.json

README.md

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

Something went wrong with that request. Please try again.