Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

stream-value-reader

kodedninja5ISC0.1.0

Concat a stream and use the value multiple times

stream, concat-stream

readme

stream-value-reader

Small wrapper around concat-stream and pump for those cases when you need to concat a stream and use its value multiple times, independent of the state of the stream.

Installation

npm i stream-value-reader

Example

var getValue = svr(stream, { encoding: 'string' })

getValue().then(function (value) {
  // waits until stream has ended
  console.log(value + ' first')
})

stream.push('hello')
stream.push(null)

getValue().then(function (value) {
  // reuses the value (approximately)
  console.log(value + ' second')
})

API

reader = streamValueReader(stream, opts)

Returns a function that returns a Promise, which will be called with the concatenated stream value.

opts is forwarded to concat-stream.