pull-buffer

1.0.2 • Public • Published

pull-buffer

Build Status dependencies Status

Buffer a pull stream and then stream the buffer as a single value.

Like pull.collect but instead of a sink this is a through.

Example

 
const pull = require('pull-stream')
const buffer = require('pull-buffer')
 
pull(
  pull.values([1, 2, 3]),
  // Multiply by 2 after a second
  pull.asyncMap((n, cb) => setTimeout(() => cb(null, n * 2), 1000)),
  // Buffer the values in memory
  buffer(),
  // Collect the buffered contents.
  // Only one value will be streamed and then the stream will end
  pull.collect((err, data) => {
    console.log(data) // [[2, 4, 6]]
  })
)

Readme

Keywords

Package Sidebar

Install

npm i pull-buffer

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • alanshaw