0.0.1 • Published 6 years ago

pull-resize-buffers v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

pull-resize-buffers

Build status Coverage Status Dependencies Status

Resizes streams of buffers

Installation

$ npm install --save pull-resize-buffers

Usage

const pull = require('pull-streams/pull')
const values = require('pull-streams/values')
const collect = require('pull-streams/collect')
const resizeBuffers = require('pull-resize-buffers')

pull(

  // a source that emits Node.js Buffers of varying lengths
  values([Buffer.alloc(8192), Buffer.alloc(1024), ...]),

  // reformat the buffers to all be 4096 bytes long
  resizeBuffers(4096),

  collect((error, buffers) => {
    // `buffers` is an array of buffers all 4096 bytes long. The final buffer may be shorter
  })
)