stream-chunker
Advanced tools
Comparing version 1.2.7 to 1.2.8
@@ -49,6 +49,6 @@ /** | ||
if (opts.align) { | ||
var remaining = new Buffer(chunkSize - buffer.length); | ||
remaining.fill(0); | ||
buffer = Buffer.concat([ buffer, remaining ], chunkSize); | ||
if (opts.align && buffer.length > 0) { | ||
var remaining = new Buffer(chunkSize - buffer.length); | ||
remaining.fill(0); | ||
buffer = Buffer.concat([ buffer, remaining ], chunkSize); | ||
} | ||
@@ -55,0 +55,0 @@ |
{ | ||
"name": "stream-chunker", | ||
"version": "1.2.7", | ||
"version": "1.2.8", | ||
"description": "A transform stream which chunks incoming data into chunkSize byte chunks", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -44,4 +44,5 @@ var Chunker = require('../index.js'); | ||
test('Test align option', function (t) { | ||
t.plan(1); | ||
t.plan(2); | ||
var optsFlushAlign = { | ||
@@ -64,2 +65,12 @@ flush: true, | ||
function checkAlignedFlushAlign(data) { | ||
t.equals(data, '1234', 'Received flush data'); | ||
} | ||
var chunkerAlignedFlushAlign = Chunker(4, optsFlushAlign); | ||
var concatStreamAlignedFlushAlign = concat(checkAlignedFlushAlign); | ||
chunkerAlignedFlushAlign.pipe(concatStreamAlignedFlushAlign); | ||
chunkerAlignedFlushAlign.write('12'); | ||
chunkerAlignedFlushAlign.write('34'); | ||
chunkerAlignedFlushAlign.end(); | ||
}); |
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
10487
165