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

Function drain

packages/computerd/src/exec/runner.test.ts:34–47  ·  view source on GitHub ↗
(stream: ReadableStream<ExecEvent>)

Source from the content-addressed store, hash-verified

32}
33
34async function drain(stream: ReadableStream<ExecEvent>): Promise<ExecEvent[]> {
35 const events: ExecEvent[] = [];
36 const reader = stream.getReader();
37 try {
38 while (true) {
39 const { value, done } = await reader.read();
40 if (done) break;
41 events.push(value);
42 }
43 } finally {
44 reader.releaseLock();
45 }
46 return events;
47}
48
49function decode(value: Uint8Array): string {
50 return new TextDecoder().decode(value);

Callers 1

runner.test.tsFile · 0.70

Calls 3

getReaderMethod · 0.65
readMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected