1.0.1 • Published 5 years ago
psp-drain v1.0.1
Pull stream drain
A modern version of the pull-stream drain sink which returns a promise rather than calling a callback.
const {pull, values} = require('pull-stream')
const drain = require('psp-drain')
pull(values([1, 2, 3]), drain(console.log)).then(() => console.log('Done'))
drain([op])
Abort
const {pull, values} = require('pull-stream')
const drain = require('psp-drain')
const sink = drain()
sink.abort()
pull(values([1, 2, 3]), sink).then(() => console.log('Done'))
const sink = drain()
sink.abort(new Error())
pull(values([1, 2, 3]), sink).catch(console.error)
abort([err])