Slice a cached or freshly-fetched full body to the requested range.
(
fullData: Uint8Array,
offset: number,
clampedByteCount: number,
)
| 768 | |
| 769 | /** Slice a cached or freshly-fetched full body to the requested range. */ |
| 770 | function sliceToChunk( |
| 771 | fullData: Uint8Array, |
| 772 | offset: number, |
| 773 | clampedByteCount: number, |
| 774 | ): { data: Uint8Array; totalBytes: number } { |
| 775 | const totalBytes = fullData.length; |
| 776 | const start = Math.min(offset, totalBytes); |
| 777 | const end = Math.min(start + clampedByteCount, totalBytes); |
| 778 | return { data: fullData.slice(start, end), totalBytes }; |
| 779 | } |
| 780 | |
| 781 | async function readPdfRange( |
| 782 | url: string, |
no outgoing calls
no test coverage detected
searching dependent graphs…