stream-object-buffer

1.0.1 • Public • Published

stream-object-buffer

Very simple stream object buffer. Helps you to buffer your stream objects into chunks of a size for batch processing ... or debuffer them into single items.

Installation

npm install --save stream-object-buffer

Usage

This will make the destination stream receive database rows in chunks of a specific size.

const { StreamBuffer } = require('stream-object-buffer')

db.createReadStream()
  // Group rows in nice chunks
  .pipe(new StreamBuffer(666))
  .pipe(destinationStream)
  // ['row1', 'row2', ...], ['row667', 'row668', ...], ['row1332']

And this will unwrap the chunks into single objects again

const { StreamBuffer } = require('stream-object-buffer')

db.createReadStream()
  // Group rows in nice chunks
  .pipe(new StreamBuffer(666))
  // Degroup rows
  .pipe(new StreamDebuffer())
  .pipe(destinationStream)
  // 'row1', 'row2', 'row3', ...

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    2
  • 1.0.0
    0

Package Sidebar

Install

npm i stream-object-buffer

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

4.08 kB

Total Files

7

Last publish

Collaborators

  • just-paja