node:tty

#Import

import tty from "nstdlib/node/tty";

Note

The API is available, but not everything works. isatty() answers false for every descriptor unless a host says otherwise, which is what the same call answers for a pipe in Node. ReadStream and WriteStream need a host to back the TTY handle on node_binding_tty_wrap_dispatch. Raw mode, the window size and a descriptor to read. And throw ERR_NSTDLIB_NO_BINDING at construction where nothing does. native/ backs it, over termios, ioctl(TIOCGWINSZ) and uv_tty_init's own reopen.

#Support

node:tty. nstd: works; Node test suite 100% passing. Browser: not tested; export coverage 100%; Node test suite 66.7% passing.

  • nstd: Gives the same output as Node.js in side-by-side tests: repl.
  • Browser: Loads with a minimal process object. 3 of Node's 3 exports are available. No behavior check covers it yet.

#Exports (3)

Every name Node.js exports from this module, and what you get when you read it, as a named import or as a property of the default import:

  • ✅ A value, both ways. An export that throws an error naming the missing feature also counts.
  • ⚠️ A value one way, undefined the other.
  • ❔ undefined both ways.
  • ❌ Not exported at all.
  • – Not measured.
ExportNode.jsBrowser
ReadStream✅✅
WriteStream✅✅
isatty✅✅

#Diagnostics

nstdlib running inside Node.js. This isn't an environment it's meant for, so it isn't shown above, but it tells a library problem from an environment one:

  • coverage: 3/3 of the host's export names answer inside host node. API only. isatty() answers false for every descriptor unless a host says otherwise, which is what the same call answers for a pipe in Node. ReadStream and WriteStream need a host to back the TTY handle on node_binding_tty_wrap_dispatch. Raw mode, the window size and a descriptor to read. And throw ERR_NSTDLIB_NO_BINDING at construction where nothing does. native/ backs it, over termios, ioctl(TIOCGWINSZ) and uv_tty_init's own reopen.
  • smoke: Imports in a clean child process.
  • node-suite: 2/3 of Node's own eligible tests pass with ./dist inside host node. A failure there and in the page is the library's, one only in the page is the engine's.