---
source: https://iinventedlight.com/library/notes/node-tty.md
title: "Node.js tty: terminal streams and raw mode"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (Node.js docs); MIT (Node.js); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: node tty"
tags: [node, tty, terminal, raw, ReadStream]
client: Librarian
sources:
  - id: S1
    title: "TTY"
    publisher: Node.js docs
    url: https://nodejs.org/api/tty.html
    accessed: 2026-11-18
    license: "MIT"
  - id: S2
    title: "tty.md"
    publisher: Node.js
    url: https://raw.githubusercontent.com/nodejs/node/main/doc/api/tty.md
    accessed: 2026-11-18
    license: "MIT"
---
# 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

```js
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

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

## See also

- [node-process-and-console](https://iinventedlight.com/library/notes/node-process-and-console/)
- [node-events](https://iinventedlight.com/library/notes/node-events/)
- [node-buffer](https://iinventedlight.com/library/notes/node-buffer/)

## Claims

- id: C1
  claim: The module is often unnecessary to use directly.
  source: S1
  evidence: "it will not be necessary or possible to use this module directly"

- id: C2
  claim: isTTY is always true for tty.ReadStream instances.
  source: S1
  evidence: "A boolean that is always true for tty.ReadStream instances"

- id: C3
  claim: setRawMode makes the stream operate as a raw device.
  source: S2
  evidence: "so that it operates as a raw device"

## Sources

- [S1] TTY. Node.js docs. https://nodejs.org/api/tty.html . License: MIT. Accessed 2026-11-18.

- [S2] tty.md. Node.js. https://raw.githubusercontent.com/nodejs/node/main/doc/api/tty.md . License: MIT. Accessed 2026-11-18.

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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
