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

Function textStream

packages/effect/test/unstable/httpapi/HttpApiClient.test.ts:833–844  ·  view source on GitHub ↗
(chunks: ReadonlyArray<string>)

Source from the content-addressed store, hash-verified

831 )
832
833const textStream = (chunks: ReadonlyArray<string>): ReadableStream<Uint8Array> => {
834 let index = 0
835 return new ReadableStream<Uint8Array>({
836 pull(controller) {
837 if (index === chunks.length) {
838 controller.close()
839 } else {
840 controller.enqueue(textEncoder.encode(chunks[index++]!))
841 }
842 }
843 })
844}
845
846const byteStream = (chunks: ReadonlyArray<Uint8Array>): ReadableStream<Uint8Array> => {
847 let index = 0

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected