MCPcopy Create free account
hub / github.com/Effect-TS/effect / byteStream

Function byteStream

packages/effect/test/unstable/httpapi/HttpApiClient.test.ts:846–857  ·  view source on GitHub ↗
(chunks: ReadonlyArray<Uint8Array>)

Source from the content-addressed store, hash-verified

844}
845
846const byteStream = (chunks: ReadonlyArray<Uint8Array>): ReadableStream<Uint8Array> => {
847 let index = 0
848 return new ReadableStream<Uint8Array>({
849 pull(controller) {
850 if (index === chunks.length) {
851 controller.close()
852 } else {
853 controller.enqueue(chunks[index++]!)
854 }
855 }
856 })
857}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected