asyncsse
Version:
Fetch Server-Sent Events (SSE) as an async iterable
12 lines (11 loc) • 423 B
TypeScript
/**
* Creates a mock fetch Response that streams the provided text as SSE events
*
* @param {string} text - The SSE formatted text to stream
* @returns {Promise<Response>}A Promise that resolves to a mock Response object
*
* @example
* const text = "data: Hello\n\ndata: World\n\n";
* const events = asyncSSE(text, {}, { fetch: fetchText });
*/
export declare const fetchText: (text: string) => Promise<Response>;