highland-callback
v1.0.1
Published
Call a node callback with an optional error after stream completes.
Downloads
28
Readme
Highland Callback
Run callback after a stream is complete. This will run the callback once, on the first error or when the stream has
finished. Note that you should only use this as the last .consume
in the stream chain.
Install
npm install highland-callback
Usage
var _ = require('highland');
var highlandCallback = require('highland-callback');
_([1, 2, 3])
.consume(highlandCallback(function(error) {
// executed after nil is seen, in this case all the values will be logged before this is executed
console.log('executed');
console.log('hi');
}))
.doto(function(value) {
console.log(value);
})
.resume();
// output:
// 1
// 2
// 3
// executed