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

Function readJson

packages/computerd/src/cli/computerd.ts:406–414  ·  view source on GitHub ↗
(request: IncomingMessage)

Source from the content-addressed store, hash-verified

404}
405
406async function readJson<T>(request: IncomingMessage): Promise<T> {
407 const chunks: Buffer[] = [];
408 for await (const chunk of request) {
409 chunks.push(chunk as Buffer);
410 }
411 const text = Buffer.concat(chunks).toString("utf8");
412 if (text.length === 0) return {} as T;
413 return JSON.parse(text) as T;
414}
415
416function toWebSocketUrl(input: string): string {
417 if (input.startsWith("ws://") || input.startsWith("wss://")) return input;

Callers

nothing calls this directly

Calls 2

pushMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected