(chunks: ReadonlyArray<Uint8Array>)
| 1966 | } |
| 1967 | |
| 1968 | const 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 | } |