← All notes

Node.js tty: terminal streams and raw mode

Answer: tty.ReadStream is the readable side of a TTY. isTTY is always true for those instances. setRawMode makes the stream operate as a raw device.

Examples

import tty from 'node:tty';
if (process.stdin.isTTY) {
  process.stdin.setRawMode(true);
}

Notes

The docs say its value will change with subsequent calls to setRawMode for isRaw; isTTY stays true.

Reference list

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Node.js docs, TTY; Node.js, tty.md. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Node.js docs, TTY; Node.js, tty.md. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors.

Cite this

Permanent ID: iil:note:xjwhbn8m

iinventedlight. 2026. "Node.js tty: terminal streams and raw mode." iinventedlight Library, iil:note:xjwhbn8m, version of 2026-11-18. https://iinventedlight.com/library/notes/node-tty/. License: CC-BY-4.0.

@misc{iil_note_xjwhbn8m,
  author = {{iinventedlight}},
  title = {{Node.js tty: terminal streams and raw mode}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/node-tty/},
  note = {Permanent ID iil:note:xjwhbn8m. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/node-tty.md.