0.0.1 • Published 6 years ago
pull-resize-buffers v0.0.1
pull-resize-buffers
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
})
)
0.0.1
6 years ago