Comparing version 1.2.0 to 1.3.0
@@ -83,3 +83,5 @@ | ||
function decodeWithHeader(buf, enc, done) { | ||
this._chunks.append(buf) | ||
// needed for recursive invocation | ||
if (buf) | ||
this._chunks.append(buf) | ||
@@ -105,6 +107,11 @@ // we need to parse the header | ||
this.emit('error', err) | ||
return; | ||
} | ||
} | ||
done() | ||
if (this._chunks.length > 0) { | ||
this._transform(null, enc, done) | ||
} | ||
else | ||
done() | ||
} | ||
@@ -111,0 +118,0 @@ |
{ | ||
"name": "msgpack5", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A msgpack v5 implementation for node.js, with extension points", | ||
@@ -33,2 +33,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"bl": "^0.9.3", | ||
"faucet": "0.0.1", | ||
@@ -35,0 +36,0 @@ "jshint": "^2.5.2", |
var test = require('tape').test | ||
, msgpack = require('../') | ||
, BufferList = require('bl') | ||
@@ -186,1 +187,30 @@ test('must send an object through', function(t) { | ||
}) | ||
test('concatenated buffers work', function(t) { | ||
var pack = msgpack() | ||
, encoder = pack.encoder() | ||
, decoder = pack.decoder() | ||
, data = [ | ||
{ hello: 1 } | ||
, { hello: 2 } | ||
, { hello: 3 } | ||
] | ||
t.plan(data.length) | ||
var bl = new BufferList() | ||
encoder.on('data', bl.append.bind(bl)) | ||
data.forEach(encoder.write.bind(encoder)) | ||
decoder.on('data', function(d) { | ||
t.deepEqual(d, data.shift()) | ||
}) | ||
encoder.once('finish', function() { | ||
var buf = bl.slice() | ||
decoder.write(buf) | ||
}) | ||
encoder.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
117946
2130
6