linesOf(source: NodeJS.ReadableStream): AsyncIterable<string>
The lines of source, ending when it does — including when it ended before anyone asked.
readline waits for an end event, and a stream emits that once: a stdin that reached EOF while
the browser was still starting leaves readline waiting forever. Deno on Windows ends an empty
piped stdin that early, and qunitx repl < /dev/null hung there until the test timeout killed it.
import { Readable } from 'node:stream'; import { linesOf } from './index.ts'; const lines = []; for await (const line of linesOf(Readable.from(['a\nb\n']))) lines.push(line); lines; // ['a', 'b']