MCPcopy
hub / github.com/TanStack/ai / collectChunks

Function collectChunks

packages/ai/tests/test-utils.ts:224–232  ·  view source on GitHub ↗
(
  stream: AsyncIterable<StreamChunk>,
)

Source from the content-addressed store, hash-verified

222
223/** Collect all chunks from an async iterable. */
224export async function collectChunks(
225 stream: AsyncIterable<StreamChunk>,
226): Promise<Array<StreamChunk>> {
227 const chunks: Array<StreamChunk> = []
228 for await (const c of stream) {
229 chunks.push(c)
230 }
231 return chunks
232}
233
234// ============================================================================
235// Type guards & extraction helpers

Calls 1

pushMethod · 0.45

Tested by 2

runChatWithMiddlewareFunction · 0.72
runWithToolAndCaptureFunction · 0.72