MCPcopy Create free account
hub / github.com/Alphanimble/htmlstream / nextChunkSize

Function nextChunkSize

demo/chat/stream-replay.ts:26–31  ·  view source on GitHub ↗
(text: string, index: number, chunkSize: number)

Source from the content-addressed store, hash-verified

24}
25
26function 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. */
34export async function replayStream(

Callers 1

replayStreamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected