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

Function textStream

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

Source from the content-addressed store, hash-verified

1953 )
1954
1955const textStream = (chunks: ReadonlyArray<string>): ReadableStream<Uint8Array> => {
1956 let index = 0
1957 return new ReadableStream<Uint8Array>({
1958 pull(controller) {
1959 if (index === chunks.length) {
1960 controller.close()
1961 } else {
1962 controller.enqueue(textEncoder.encode(chunks[index++]!))
1963 }
1964 }
1965 })
1966}
1967
1968const byteStream = (chunks: ReadonlyArray<Uint8Array>): ReadableStream<Uint8Array> => {
1969 let index = 0

Callers 3

decodeFunction · 0.85
eventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected