MCPcopy Index your code
hub / github.com/TanStack/ai / getResponseStreamReader

Function getResponseStreamReader

packages/ai-client/src/response-stream.ts:22–34  ·  view source on GitHub ↗
(
  response: Response,
)

Source from the content-addressed store, hash-verified

20}
21
22export function getResponseStreamReader(
23 response: Response,
24): ReadableStreamDefaultReader<Uint8Array> {
25 if (!response.body) {
26 throw new UnsupportedResponseStreamError('Response.body')
27 }
28
29 if (typeof response.body.getReader !== 'function') {
30 throw new UnsupportedResponseStreamError('Response.body.getReader')
31 }
32
33 return response.body.getReader()
34}
35
36export function createResponseStreamTextDecoder(): TextDecoder {
37 if (typeof globalThis.TextDecoder !== 'function') {

Callers 3

responseToSSEChunksFunction · 0.90
connectFunction · 0.90
parseSSEResponseFunction · 0.90

Calls 1

getReaderMethod · 0.80

Tested by

no test coverage detected