node:readline

#Import

import readline from "nstdlib/node/readline";

Note

The API is available, but not everything works. Works over any pair of streams. The terminal half. Raw mode, the window size, a descriptor to read. Needs a host to back the TTY handle over node_binding_tty_wrap_dispatch, and native/ does, over termios and ioctl(TIOCGWINSZ). No runtime here delivers SIGWINCH, so a 'resize' event never fires.

#Support

node:readline. nstd: works; Node test suite 86.4% passing. Browser: not tested; export coverage 100%; Node test suite 95.5% passing.

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

#Exports (8)

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
Interface✅✅
clearLine✅✅
clearScreenDown✅✅
createInterface✅✅
cursorTo✅✅
emitKeypressEvents✅✅
moveCursor✅✅
promises✅✅

#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: 8/8 of the host's export names answer inside host node. API only. Works over any pair of streams. The terminal half. Raw mode, the window size, a descriptor to read. Needs a host to back the TTY handle over node_binding_tty_wrap_dispatch, and native/ does, over termios and ioctl(TIOCGWINSZ). No runtime here delivers SIGWINCH, so a 'resize' event never fires.
  • smoke: Imports in a clean child process.
  • node-suite: 22/22 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.