https://assets.streampdf.com/PDF32000_2008.pdf — 22.5 MB,
served with Accept-Ranges: bytes, so both the full GET and byte-range requests work.
fetch() resolves the moment the response headers arrive —
the body is still streaming at this point. Nothing is downloaded in full yet.
response.body.getReader() pulls exactly one chunk. PDF.js does the same:
it reads only the bytes the parser actually needs.
reader.cancel() closes the body stream and the browser drops the underlying
connection; controller.abort() aborts the request itself. In DevTools this
request turns into 200 (canceled) — the remaining ~22 MB are never transferred.
The follow-up request asks for the last 1 KB —
Range: bytes=(fileSize-1024)-(fileSize-1), which is exactly what PDF.js does
when it needs startxref at the tail of the file. It gets
206 Partial Content: one kilobyte instead of the whole file.
Tip: tick Disable cache in the Network panel, otherwise a second run may be served from the browser cache and the download sizes look misleading.