Comparing version 1.7.2 to 1.8.0
# History | ||
## 1.8.0 | ||
* add option not to log partial packets in full chunk parser | ||
## 1.7.2 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "protodef", | ||
"version": "1.7.2", | ||
"version": "1.8.0", | ||
"description": "A simple yet powerful way to define binary protocols", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -60,6 +60,7 @@ const Transform = require('readable-stream').Transform | ||
class FullPacketParser extends Transform { | ||
constructor (proto, mainType) { | ||
constructor (proto, mainType, noErrorLogging = false) { | ||
super({ readableObjectMode: true }) | ||
this.proto = proto | ||
this.mainType = mainType | ||
this.noErrorLogging = noErrorLogging | ||
} | ||
@@ -75,3 +76,3 @@ | ||
packet = this.parsePacketBuffer(chunk) | ||
if (packet.metadata.size !== chunk.length) { | ||
if (packet.metadata.size !== chunk.length && !this.noErrorLogging) { | ||
console.log('Chunk size is ' + chunk.length + ' but only ' + packet.metadata.size + ' was read ; partial packet : ' + | ||
@@ -78,0 +79,0 @@ JSON.stringify(packet.data) + '; buffer :' + chunk.toString('hex')) |
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
149772
4146