1.0.0 • Published 8 years ago

async-concat-stream v1.0.0

Weekly downloads
30
License
MIT
Repository
github
Last release
8 years ago

async-concat-stream

Asynchronous concat-stream. Writable stream that concatenates string or binary data and returns a promise that resolves with the result.

npm Build Status devDependency Status node

Usage

const concat = require('async-concat-stream')

concat(opts = {})

Creates a writable concat-stream. The promise property of the returned stream will be resolved when all of the data has been written to the stream.

Parameters:

  • opts - concat-stream options

Returns: Writable - writable stream from concat-stream with promise property

Usage:

let writable = concat()
readable.pipe(writable)
let data = await writable.promise // via ES7 async

concat.from(readable, opts = {})

Convenience method to read from the specified readable stream. Also handles errors from the readable stream.

Parameters:

  • readable - Readable, The readable stream
  • opts - concat-stream options Returns: Promise - resolves with the data from concat-stream

Usage:

let data = await concat.from(readable) // via ES7 async

Why make this when there are ~2 others?

I like to avoid promise modules and unnecessarily adding stuff to and hybridizing promises.

License

MIT

1.0.0

8 years ago