INNER CODE UNIT · TypeScript

buffer

tomascupr/sandstorm · clients/typescript/src/index.ts:110

        buffer = buffer.slice(boundary + 2);
        const parsed = parseSSEEvent(rawEvent);
        if (parsed) yield parsed;
        boundary = buffer.indexOf("\n\n");
      }
    }
  } finally {
    reader.releaseLock();
  }
}

function parseSSEEvent(raw: string): SSEEvent | null {
  const lines = raw.split(/\r?\n/);
  const dataLines: string[] = [];
  let event: string | undefined;
  for (const line of lines) {
    if (!line || line.startsWith(":")) continue; // comments / keepalives
    if (line.startsWith("data:")) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…