( blob: Blob, sizeLimit: number = ARCHIVE_SIZE_LIMIT )
| 59 | * Validate downloaded archive size after streaming or fallback blob creation. |
| 60 | */ |
| 61 | export function validateDownloadedArchiveSize( |
| 62 | blob: Blob, |
| 63 | sizeLimit: number = ARCHIVE_SIZE_LIMIT |
| 64 | ): void { |
| 65 | if (blob.size > sizeLimit) { |
| 66 | const sizeMB = (blob.size / (1024 * 1024)).toFixed(1); |
| 67 | throw new Error(`Downloaded archive exceeds size limit (${sizeMB}MB)`); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | async function readStreamingResponseBlob( |
| 72 | body: ReadableStream<Uint8Array>, |
no outgoing calls
no test coverage detected