highland-callback
Version:
Call a node callback with an optional error after stream completes.
31 lines (23 loc) • 743 B
Markdown
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.
npm install highland-callback
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