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

Function drainStream

packages/computerd/src/exec/runner.fuse.test.ts:159–166  ·  view source on GitHub ↗
(stream: NodeJS.ReadableStream)

Source from the content-addressed store, hash-verified

157});
158
159async function drainStream(stream: NodeJS.ReadableStream): Promise<string> {
160 const chunks: Buffer[] = [];
161 return new Promise((resolveStream, rejectStream) => {
162 stream.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
163 stream.on("end", () => resolveStream(Buffer.concat(chunks).toString("utf8")));
164 stream.on("error", rejectStream);
165 });
166}
167
168async function waitForExit(proc: ChildProcess): Promise<void> {
169 if (proc.exitCode !== null) return;

Callers 1

Calls 2

pushMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected