end-stream
A stream that ends after computation finishes
Last updated 14 years ago by raynos .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install end-stream 
SYNC missed versions from official npm registry.

end-stream

A stream that ends after computation finishes

Example

When you end this writable stream it will only emit "finish" after it's finished asynchronously writing each chunk you've written to the stream

var stream = EndStream(function write(value, cb) {
    // do something async
    async(value, function (err) {
        // tell cb that your done writing it.
        // Optionally pass it an err as a shorthand for
        // stream.emit("error", err)
        cb(err)
    })
})

stream.write(foo)
stream.write(bar)

stream.end()
stream.on("finish", function () {
    // only called after both foo and bar have been
    // asynchronously written. e.g. persisted to db.
})

Installation

npm install end-stream

Contributors

  • Raynos

MIT Licenced

Current Tags

  • 0.1.0                                ...           latest (14 years ago)

1 Versions

  • 0.1.0                                ...           14 years ago
Maintainers (1)
Downloads
Total 4
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (1)
Dependents (1)

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