Function
nextChunkSize
(text: string, index: number, chunkSize: number)
Source from the content-addressed store, hash-verified
| 24 | } |
| 25 | |
| 26 | function nextChunkSize(text: string, index: number, chunkSize: number): number { |
| 27 | if (chunkSize > 0) { |
| 28 | return Math.min(chunkSize, text.length - index); |
| 29 | } |
| 30 | return Math.min(1 + Math.floor(Math.random() * 8), text.length - index); |
| 31 | } |
| 32 | |
| 33 | /** Replay saved HTML text chunk-by-chunk like a live API stream. */ |
| 34 | export async function replayStream( |
Tested by
no test coverage detected