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

Function streamOf

packages/dofs/src/fs/writeFile.test.ts:54–65  ·  view source on GitHub ↗
(...chunks: Uint8Array[])

Source from the content-addressed store, hash-verified

52}
53
54function streamOf(...chunks: Uint8Array[]): ReadableStream<Uint8Array> {
55 let i = 0;
56 return new ReadableStream<Uint8Array>({
57 pull(controller) {
58 if (i < chunks.length) {
59 controller.enqueue(chunks[i++]);
60 } else {
61 controller.close();
62 }
63 },
64 });
65}
66
67describe("writeFile", () => {
68 it("writes a small string and stores one chunk", async () => {

Callers 1

writeFile.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected