chunked-buffer
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "chunked-buffer", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Small function you can wrap fs.createReadStream with to get fixed size data chunks", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# chunked-buffer | ||
[![Downloads](https://img.shields.io/npm/dt/chunked-buffer.svg)]() | ||
Small function you can wrap fs.createReadStream with to get fixed size data chunks. | ||
#### Small function you can wrap fs.createReadStream with to get fixed size data chunks. | ||
*chunked-buffer* modifies the stream.Readable 'data' event to make 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 | ||
```javascript | ||
const chunked = require('chunked-buffer') | ||
const rs = chunked(fs.createReadStream('path/to/file'), { chunkSize: 20000 }) | ||
const rs = chunked(fs.createReadStream('path/to/file'), { chunkSize: 20000 }) | ||
chunked.on('data', (chunk) => { | ||
rs.on('data', (chunk) => { | ||
// chunk is a Buffer with a size of 20000 bytes. | ||
}) | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2423
17