Add a progressiveDataLength fast-path to ChunkedStream.ensureByte

This is *similar* to the existing check using in `ChunkedStream.ensureRange`.
This commit is contained in:
Jonas Jenwald 2019-03-29 19:57:52 +01:00
parent 49e8a270c4
commit c6ddbd55e2

View File

@ -98,6 +98,10 @@ class ChunkedStream {
}
ensureByte(pos) {
if (pos < this.progressiveDataLength) {
return;
}
const chunk = Math.floor(pos / this.chunkSize);
if (chunk === this.lastSuccessfulEnsureByteChunk) {
return;