( response: Response, onProgress?: DownloadProgressCallback )
| 138 | * downloads so both can drive the byte counter in the loading overlay. |
| 139 | */ |
| 140 | export async function readResponseToBlob( |
| 141 | response: Response, |
| 142 | onProgress?: DownloadProgressCallback |
| 143 | ): Promise<Blob> { |
| 144 | if (!onProgress || !response.body) { |
| 145 | return response.blob(); |
| 146 | } |
| 147 | const total = parseSafeIntegerString(response.headers.get('content-length') ?? '') ?? 0; |
| 148 | return readResponseStreamToBlob(response.body, total, onProgress); |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Read a fetch response body to a Blob, reporting bytes as they arrive. Builds |
no test coverage detected