streamConsole(stdout: { write(text: string): unknown; },stderr?: { write(text: string): unknown; }): Console
Adapts anything with a write(string) — a node:fs stream, a socket, an array-backed fake —
into a Console. stderr defaults to stdout, so one stream collects the whole run.
import { streamConsole } from './console.ts'; const chunks: string[] = []; streamConsole({ write: (text: string) => void chunks.push(text) }).error('# warning\n'); chunks; // ['# warning\n'] — with no stderr given, both channels land in the one stream