MCPcopy Create free account
hub / github.com/cloudflare/computer / collect

Function collect

packages/computer/src/exec-wire.test.ts:22–35  ·  view source on GitHub ↗
(stream: ReadableStream<T>)

Source from the content-addressed store, hash-verified

20}
21
22async function collect<T>(stream: ReadableStream<T>): Promise<T[]> {
23 const out: T[] = [];
24 const reader = stream.getReader();
25 try {
26 while (true) {
27 const { value, done } = await reader.read();
28 if (done) break;
29 out.push(value);
30 }
31 } finally {
32 reader.releaseLock();
33 }
34 return out;
35}
36
37async function roundTrip<E extends "utf8" | undefined>(
38 events: WorkspaceExecEvent<E>[],

Callers 2

roundTripFunction · 0.70
exec-wire.test.tsFile · 0.70

Calls 3

getReaderMethod · 0.65
readMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected