MCPcopy Create free account
hub / github.com/TanStack/router / createDelayedStream

Function createDelayedStream

e2e/solid-start/basic/src/raw-stream-fns.ts:4–17  ·  view source on GitHub ↗
(
  chunks: Array<Uint8Array>,
  delayMs: number,
)

Source from the content-addressed store, hash-verified

2
3// Helper to create a delayed Uint8Array stream
4function createDelayedStream(
5 chunks: Array<Uint8Array>,
6 delayMs: number,
7): ReadableStream<Uint8Array> {
8 return new ReadableStream<Uint8Array>({
9 async start(controller) {
10 for (const chunk of chunks) {
11 await new Promise((resolve) => setTimeout(resolve, delayMs))
12 controller.enqueue(chunk)
13 }
14 controller.close()
15 },
16 })
17}
18
19// Helper to create a stream with variable delays per chunk
20// Each entry is [chunk, delayBeforeMs] - delay happens BEFORE enqueueing the chunk

Callers 6

ssr-mixed.tsxFile · 0.90
ssr-text-hint.tsxFile · 0.90
ssr-single.tsxFile · 0.90
ssr-multiple.tsxFile · 0.90
raw-stream-fns.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected