| 7 | } from './zipDownload'; |
| 8 | |
| 9 | function createStreamedResponse(chunks: number[][], contentLength?: number): Response { |
| 10 | return new Response(new ReadableStream<Uint8Array>({ |
| 11 | start(controller) { |
| 12 | for (const chunk of chunks) { |
| 13 | controller.enqueue(new Uint8Array(chunk)); |
| 14 | } |
| 15 | controller.close(); |
| 16 | }, |
| 17 | }), { |
| 18 | status: 200, |
| 19 | headers: contentLength === undefined ? undefined : { |
| 20 | 'content-length': String(contentLength), |
| 21 | }, |
| 22 | }); |
| 23 | } |
| 24 | |
| 25 | describe('zip download', () => { |
| 26 | it('streams archive downloads with bounded progress and concatenates chunks', async () => { |