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

Function fetchStream

e2e/solid-start/basic/src/routes/stream.tsx:31–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29
30 createEffect(() => {
31 async function fetchStream() {
32 const reader = loaderData().stream.getReader()
33 let chunk
34
35 while (!(chunk = await reader.read()).done) {
36 let value = chunk.value
37 if (typeof value !== 'string') {
38 value = decoder.decode(value, { stream: !chunk.done })
39 }
40 setStreamData((prev) => [...prev, value])
41 }
42 }
43
44 fetchStream()
45 })

Callers 1

HomeFunction · 0.70

Calls 1

getReaderMethod · 0.65

Tested by

no test coverage detected