(chunks: ReadonlyArray<Uint8Array>)
| 844 | } |
| 845 | |
| 846 | const 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 | } |