Merge pull request #15539 from Snuffleupagus/DecryptStream-set
Replace loop with `TypedArray.prototype.set` in the `DecryptStream.readBlock` method
This commit is contained in:
commit
3cb119cb32
@ -46,13 +46,11 @@ class DecryptStream extends DecodeStream {
|
||||
const decrypt = this.decrypt;
|
||||
chunk = decrypt(chunk, !hasMoreData);
|
||||
|
||||
let bufferLength = this.bufferLength;
|
||||
const n = chunk.length,
|
||||
buffer = this.ensureBuffer(bufferLength + n);
|
||||
for (let i = 0; i < n; i++) {
|
||||
buffer[bufferLength++] = chunk[i];
|
||||
}
|
||||
this.bufferLength = bufferLength;
|
||||
const bufferLength = this.bufferLength,
|
||||
newLength = bufferLength + chunk.length,
|
||||
buffer = this.ensureBuffer(newLength);
|
||||
buffer.set(chunk, bufferLength);
|
||||
this.bufferLength = newLength;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user