parser: support Uint8Array's
This commit is contained in:
parent
9874073510
commit
3b2fd8e168
@ -38,6 +38,8 @@ Parser.prototype.feed = function feed(data) {
|
|||||||
len = utils.copy(this.pending[0], chunk, off);
|
len = utils.copy(this.pending[0], chunk, off);
|
||||||
if (len === this.pending[0].length)
|
if (len === this.pending[0].length)
|
||||||
this.pending.shift();
|
this.pending.shift();
|
||||||
|
else if (!this.pending[0].slice && this.pending[0] instanceof Uint8Array)
|
||||||
|
this.pending[0] = new Uint8Array(this.pending[0].buffer.slice(len));
|
||||||
else
|
else
|
||||||
this.pending[0] = this.pending[0].slice(len);
|
this.pending[0] = this.pending[0].slice(len);
|
||||||
off += len;
|
off += len;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user