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

Function streamChunks

tests/helpers/simulate-stream.ts:5–12  ·  view source on GitHub ↗
(
  full: string,
  chunkSize = 8,
)

Source from the content-addressed store, hash-verified

3
4/** Yield progressively longer prefixes of HTML (simulates token stream) */
5export function* streamChunks(
6 full: string,
7 chunkSize = 8,
8): Generator<string, void, unknown> {
9 for (let i = chunkSize; i < full.length + chunkSize; i += chunkSize) {
10 yield full.slice(0, Math.min(i, full.length));
11 }
12}
13
14/** Run rehtml at each chunk boundary */
15export function streamSnapshots(

Callers 4

streamWithoutCrashFunction · 0.90
streamSnapshotsFunction · 0.85

Calls

no outgoing calls

Tested by 1

streamWithoutCrashFunction · 0.72