Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stream-chunker

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-chunker - npm Package Compare versions

Comparing version 1.1.8 to 1.2.7

7

index.js

@@ -48,2 +48,9 @@ /**

flushFunction = function (next) {
if (opts.align) {
var remaining = new Buffer(chunkSize - buffer.length);
remaining.fill(0);
buffer = Buffer.concat([ buffer, remaining ], chunkSize);
}
this.push(buffer);

@@ -50,0 +57,0 @@ next();

2

package.json
{
"name": "stream-chunker",
"version": "1.1.8",
"version": "1.2.7",
"description": "A transform stream which chunks incoming data into chunkSize byte chunks",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -23,2 +23,3 @@ # stream-chunker

- `flush`: `boolean` - Optional. Flush incomplete chunk data on stream end. Default is `false`.
- `align`: `boolean` - Optional. Pad incomplete chunk data on stream end. Should be used in combination with `flush`. Default is `false`.
- `encoding`: `string` - Optional. Encoding of String chunks. Must be a valid Buffer encoding, such as `utf8` or `ascii`.

@@ -25,0 +26,0 @@

@@ -41,2 +41,24 @@ var Chunker = require('../index.js');

});
});
test('Test align option', function (t) {
t.plan(1);
var optsFlushAlign = {
flush: true,
align: true,
encoding: 'utf8'
}
function checkFlushAlign(data) {
t.equals(data, '12345\0\0\0', 'Received flush data');
}
var chunkerFlushAlign = Chunker(4, optsFlushAlign);
var concatStreamFlushAlign = concat(checkFlushAlign);
chunkerFlushAlign.pipe(concatStreamFlushAlign);
chunkerFlushAlign.write('12');
chunkerFlushAlign.write('34');
chunkerFlushAlign.write('5');
chunkerFlushAlign.end();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc