MCPcopy Create free account
hub / github.com/WinterTC55/iter-streams / webStreamFromArray

Function webStreamFromArray

benchmarks/html/benchmarks.js:59–74  ·  view source on GitHub ↗
(chunks)

Source from the content-addressed store, hash-verified

57}
58
59export async function webStreamFromArray(chunks) {
60 const readable = new ReadableStream({
61 start(controller) {
62 for (const chunk of chunks) controller.enqueue(chunk);
63 controller.close();
64 }
65 });
66 const reader = readable.getReader();
67 const result = [];
68 while (true) {
69 const { value, done } = await reader.read();
70 if (done) break;
71 result.push(value);
72 }
73 return result;
74}
75
76// =============================================================================
77// Transform Benchmarks

Callers

nothing calls this directly

Calls 2

pushMethod · 0.65
readMethod · 0.45

Tested by

no test coverage detected