MCPcopy Create free account
hub / github.com/denoland/std / parseStream

Function parseStream

http/server_sent_event_parse_stream_test.ts:13–20  ·  view source on GitHub ↗

Helper to parse SSE from raw string chunks

(
  chunks: string[],
)

Source from the content-addressed store, hash-verified

11
12/** Helper to parse SSE from raw string chunks */
13function parseStream(
14 chunks: string[],
15): ReadableStream<ServerSentEventParsedMessage> {
16 const encoder = new TextEncoder();
17 return ReadableStream
18 .from(chunks.map((chunk) => encoder.encode(chunk)))
19 .pipeThrough(new ServerSentEventParseStream());
20}
21
22/** Helper to roundtrip through encode then decode */
23function roundtrip(

Calls 1

fromMethod · 0.45

Tested by

no test coverage detected