MCPcopy
hub / github.com/coder/mux / readStreamAsString

Function readStreamAsString

src/node/runtime/LocalBaseRuntime.test.ts:56–69  ·  view source on GitHub ↗
(stream: ReadableStream<Uint8Array>)

Source from the content-addressed store, hash-verified

54}
55
56async function readStreamAsString(stream: ReadableStream<Uint8Array>): Promise<string> {
57 const reader = stream.getReader();
58 const decoder = new TextDecoder();
59 let output = "";
60
61 while (true) {
62 const { done, value } = await reader.read();
63 if (done) {
64 return output;
65 }
66
67 output += decoder.decode(value, { stream: true });
68 }
69}
70
71describe("LocalBaseRuntime.resolvePath", () => {
72 it("should expand tilde to home directory", async () => {

Callers 1

Calls 1

readMethod · 0.45

Tested by

no test coverage detected