(controller)
| 364 | function streamingResponse(chunks: Uint8Array[], total: number): Response { |
| 365 | const body = new ReadableStream<Uint8Array>({ |
| 366 | start(controller) { |
| 367 | for (const chunk of chunks) controller.enqueue(chunk); |
| 368 | controller.close(); |
| 369 | }, |
| 370 | }); |
| 371 | return new Response(body, { status: 200, headers: { 'content-length': String(total) } }); |
| 372 | } |