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 returns true if the given fd is associated with a TTY and false if it is not, including whenever fd is not a non-negative integer.

Classes 2

Interfaces 1

Types 1