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

Function streamOf

packages/computer/src/exec-wire.test.ts:13–20  ·  view source on GitHub ↗
(items: T[])

Source from the content-addressed store, hash-verified

11import type { WorkspaceExecEvent } from "./shell.js";
12
13function streamOf<T>(items: T[]): ReadableStream<T> {
14 return new ReadableStream<T>({
15 start(controller) {
16 for (const item of items) controller.enqueue(item);
17 controller.close();
18 },
19 });
20}
21
22async function collect<T>(stream: ReadableStream<T>): Promise<T[]> {
23 const out: T[] = [];

Callers 2

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

Calls

no outgoing calls

Tested by

no test coverage detected