MCPcopy Create free account
hub / github.com/cloudflare/templates / writeStream

Method writeStream

nlweb-template/src/ask/stream-wrapper.ts:16–19  ·  view source on GitHub ↗

* Writes a JSON object to the SSE stream. * @param data The JSON data to send.

(data: MessageResponse)

Source from the content-addressed store, hash-verified

14 * @param data The JSON data to send.
15 */
16 async writeStream(data: MessageResponse): Promise<void> {
17 const sseFormattedString = `data: ${JSON.stringify(data)}\n\n`;
18 await this.writer.write(this.encoder.encode(sseFormattedString));
19 }
20 /**
21 * Closes the stream.
22 */

Callers 3

streamLogicFunction · 0.80
summarizeStreamingFunction · 0.80
decontextualizeStreamingFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected