highland-callback

Call a node callback with an optional error after stream completes.

Usage no npm install needed!

<script type="module">
  import highlandCallback from 'https://cdn.skypack.dev/highland-callback';
</script>

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