1.0.2 • Published 9 years ago

stream-concat-promise v1.0.2

Weekly downloads
1,140
License
Unlicense
Repository
github
Last release
9 years ago

stream-concat-promise npm version

Promise version of concat-stream.

Description

A bit like concat-stream-promise but actually uses concat-stream internally, so you can use its regular options and behavior.

Usage

Standard

/**
 * @param {Stream} stream The stream to concatenate.
 * @param {Object} [opts] concat-stream options.
 * @return {Promise}
 */
import concat from 'stream-concat-promise'

concat(process.stdin)
  .then(console.log)

Mixed stream/promise

This is a version to mimic concat-stream-promise API. It can't pass the stream errors to the promise, so you're still required to do stream error handling.

/**
 * @param {Object} [opts] concat-stream options.
 * @return {Stromise} Both a stream and a promise.
 */
import concat from 'stream-concat-promise/mixed'

process.stdin
  .pipe(concat())
  .then(console.log)