Node.js module
tty
The 'node:tty' module provides the ReadStream and WriteStream classes for controlling TTY (terminal) devices. It includes methods to check if a stream is a TTY, set raw mode, and handle terminal input/output control sequences.
Use this for interactive CLI applications, handling terminal resizing, and low-level keyboard input.
Fully supported in Bun
Fully implemented.
Functions 1
- tty.isatty()
The
tty.isatty()method returnstrueif the givenfdis associated with a TTY andfalseif it is not, including wheneverfdis not a non-negative integer.
Classes 2
- class tty.ReadStream
Represents the readable side of a TTY.
- class tty.WriteStream
Represents the writable side of a TTY.
Interfaces 1
Types 1
- type Direction
-1 - to the left from cursor