method StreamClass.lines
Private
StreamClass.lines(bytes: Source<Uint8Array>): StreamClass<string>

Decodes a byte stream into text lines — the front door for NDJSON, logs, and SSE-ish feeds. Handles multi-byte characters and lines split across chunk boundaries; the final unterminated line is flushed.

const bytes = [new TextEncoder().encode('a\nb'), new TextEncoder().encode('c\nd')];
await Stream.lines(bytes).collect(); // ['a', 'bc', 'd']

Parameters

Return Type

StreamClass<string>

Usage

import { StreamClass } from "lib/stream/stream.ts";