tinky / ReadStream
Interface representing a readable stream (e.g., stdin). This abstracts away Node.js's ReadStream to make Tinky environment-agnostic.
This interface handles input events, primarily for keyboard interaction.
const myStdin: ReadStream = {
isTTY: true,
};
optionalisTTY:boolean
Indicates whether the stream is a TTY (Terminal).
optionaloff(event,listener):this
Remove an event listener.
string
The event name.
(...args) => void
The callback function.
this
The stream instance.
optionalon(event,listener):this
Register an event listener.
string
The event name (e.g., 'data').
(...args) => void
The callback function.
this
The stream instance.
optionalref():void
Keeps the process alive as long as the stream is active.
void
optionalsetEncoding(encoding):void
Sets the character encoding for data read from the stream.
string
The encoding to use (e.g., 'utf8').
void
optionalsetRawMode(mode):this
Sets the stream to raw mode.
boolean
true to enable raw mode, false to disable.
this
The stream instance.
Raw mode is required for Tinky to receive character-by-character input without waiting for Enter to be pressed.
optionalunref():void
Allows the process to exit even if the stream is active.
void