API reference
caique/terminal
Every export of caique/terminal, with its signature and doc comment: createIo, streamsOf, plus 1 type.
import { createIo, streamsOf } from 'caique/terminal';Functions
createIo
A reader and writer over a real stream pair.
The reader resolves undefined when the stream ends, which ask() reads as a
cancellation — Ctrl-D and a closed pipe both arrive that way, and both mean nobody is
going to type.
With no argument it builds over the real process, read when it is called and not at
import: a program that wants the terminal it was started in writes createIo().
function createIo(streams?: Streams): Io & {
close: () => void;
};| Parameter | Type |
|---|---|
streams (optional) | Streams |
Returns Io & { close: () => void; }
Constants
streamsOf
A runtime's two streams as the pair createIo takes — the mapping, written down once.
const streamsOf: (runtime: Runtime) => Streams;Interfaces
Streams
The stream pair a terminal Io is built over: a Runtime's stdin and its stdout.
interface Streams {
input: NodeJS.ReadableStream & {
isTTY?: boolean;
};
output: NodeJS.WritableStream & {
isTTY?: boolean;
columns?: number;
};
}