0.0.6 • Published 4 years ago

chunked-buffer v0.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

chunked-buffer

Downloads

Small function you can wrap fs.createReadStream with to get fixed size data chunks.

chunked-buffer modifies stream.Readable's 'data' event to make it so that chunks will have a fixed amount of bytes instead of getting randomly sized chunks. This can be extremely helpful if the target you pipe to expects a certain amount of bytes or if that target has a byte limitation (a udp packet for example).

Usage

const chunked = require('chunked-buffer')
const rs = chunked(fs.createReadStream('path/to/file'), { chunkSize: 20000 })

rs.on('data', (chunk) => {
  // chunk is a Buffer with a size of 20000 bytes.
})
0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago