MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / streamingResponse

Function streamingResponse

src/utils/urlUtils.test.ts:364–372  ·  view source on GitHub ↗
(chunks: Uint8Array[], total: number)

Source from the content-addressed store, hash-verified

362 });
363
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 }
373
374 it('streams the body and reports cumulative byte progress with the total', async () => {
375 const chunks = [new Uint8Array([1, 2, 3]), new Uint8Array([4, 5]), new Uint8Array([6, 7, 8, 9])];

Callers 1

urlUtils.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected