Skip to content

achingbrain/pull-resize-buffers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  })
)

About

Buffer streams of buffers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published