Function: parseSimpleTextStream()
@providerprotocol/ai / http / parseSimpleTextStream
Function: parseSimpleTextStream()
Section titled “Function: parseSimpleTextStream()”parseSimpleTextStream(
body):AsyncGenerator<string,void,unknown>
Defined in: src/http/sse.ts:173
Parses a simple text stream without SSE formatting.
This is a simpler alternative to parseSSEStream for providers that stream raw text deltas without SSE event wrappers. Each chunk from the response body is decoded and yielded as-is.
Use this for:
- Plain text streaming responses
- Providers with custom streaming formats
- Testing and debugging stream handling
Parameters
Section titled “Parameters”ReadableStream<Uint8Array<ArrayBufferLike>>
ReadableStream from fetch response body
Returns
Section titled “Returns”AsyncGenerator<string, void, unknown>
Yields
Section titled “Yields”Decoded text strings from each stream chunk
Example
Section titled “Example”const response = await doStreamFetch(url, init, config, 'custom', 'llm');
for await (const text of parseSimpleTextStream(response.body!)) { process.stdout.write(text);}