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

Function pumpJSON

packages/start-server-core/src/frame-protocol.ts:169–185  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

167 // Pumps the JSON stream, sending JSON frames
168 // JSON stream errors are fatal - they error the entire output
169 async function pumpJSON(): Promise<void> {
170 const reader = jsonStream.getReader()
171 readers.push(reader)
172 try {
173 while (!cancelled) {
174 const { done, value } = await reader.read()
175 if (done) return
176 if (!enqueue(encodeJSONFrame(value))) return
177 }
178 } catch (error) {
179 // JSON stream error is fatal - error the entire output
180 errorOutput(error)
181 throw error // Re-throw to signal failure to Promise.all
182 } finally {
183 reader.releaseLock()
184 }
185 }
186
187 // Pumps late stream registrations, spawning raw stream pumps as they arrive
188 async function pumpLateStreams(): Promise<Array<Promise<void>>> {

Callers 1

startFunction · 0.85

Calls 4

enqueueFunction · 0.85
errorOutputFunction · 0.85
encodeJSONFrameFunction · 0.70
getReaderMethod · 0.65

Tested by

no test coverage detected