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

Function byteStream

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

Source from the content-addressed store, hash-verified

1966}
1967
1968const byteStream = (chunks: ReadonlyArray<Uint8Array>): ReadableStream<Uint8Array> => {
1969 let index = 0
1970 return new ReadableStream<Uint8Array>({
1971 pull(controller) {
1972 if (index === chunks.length) {
1973 controller.close()
1974 } else {
1975 controller.enqueue(chunks[index++]!)
1976 }
1977 }
1978 })
1979}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected