Skip to content

Commit

Permalink
decouple, don't self check internals
Browse files Browse the repository at this point in the history
  • Loading branch information
GrosSacASac committed Dec 26, 2019
1 parent 3f392e1 commit 40b830e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 1 addition & 5 deletions lib/incoming_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,8 @@ IncomingForm.prototype.write = function(buffer) {
this.emit('progress', this.bytesReceived, this.bytesExpected);

this._parser.write(buffer);
var bytesParsed = this._parser.bytesWritten;
if (bytesParsed !== buffer.length) {
this._error(new Error(`parser error,${bytesParsed} of ${buffer.length} bytes parsed`));
}

return bytesParsed;
return bytesReceived;
};

IncomingForm.prototype.pause = function() {
Expand Down
2 changes: 0 additions & 2 deletions lib/json_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ class JSONParser extends Transform {
constructor() {
super({ readableObjectMode: true });
this.chunks = [];
this.bytesWritten = 0;
}

_transform(chunk, encoding, callback) {
this.bytesWritten += chunk.length;
this.chunks.push(String(chunk));// todo consider using a string decoder
callback();
}
Expand Down

0 comments on commit 40b830e

Please sign in to comment.