workers: optimize parser.
This commit is contained in:
parent
3f6a93e180
commit
227e9a18b2
@ -961,7 +961,7 @@ Parser.prototype.feed = function feed(data) {
|
||||
if (this.pendingTotal < this.waiting)
|
||||
break;
|
||||
|
||||
chunk = Buffer.concat(this.pending);
|
||||
chunk = concat(this.pending);
|
||||
|
||||
if (chunk.length > this.waiting) {
|
||||
data = chunk.slice(this.waiting);
|
||||
@ -1107,6 +1107,12 @@ function fromError(err) {
|
||||
return [err.message, err.stack + '', err.type];
|
||||
}
|
||||
|
||||
function concat(buffers) {
|
||||
return buffers.length > 1
|
||||
? Buffer.concat(buffers)
|
||||
: buffers[0];
|
||||
}
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user