pull-delayed-sink
create a sink stream, and start it later
Last updated 11 years ago by dominictarr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install pull-delayed-sink 
SYNC missed versions from official npm registry.

pull-delayed-sink

return a pull-stream sink, that won't start reading until you say.

Example

var delayed = require('pull-delayed-sink')
var feed = [], d

//create a pull stream, and direct to nowhere yet!
pull(pull.values(feed), d = delayed())


//... later, start the sink.
setTimeout(function () {
  feed.push(1, 2, 3)

  l.start(pull.collect(function (err, ary) {
    if(err) throw err
    t.deepEqual(ary, [1, 2, 3])
    t.end()
  }))
})

pull.defer is a similar function, but it's a source instead of a sink.

API

d = delayed(); d.start(sink)

create a fake sink stream, and then start it when you have the sink you want.

d = delayed(sink); d.start()

make a sink delay, and then allow it to start.

License

MIT

Current Tags

  • 1.0.0                                ...           latest (11 years ago)

1 Versions

  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)

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