psp-drain

1.0.1 • Public • Published

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])

Readme

Keywords

none

Package Sidebar

Install

npm i psp-drain

Weekly Downloads

3

Version

1.0.1

License

none

Unpacked Size

5.82 kB

Total Files

4

Last publish

Collaborators

  • thomas-jensen