Node.js module

readline

The 'node:readline' module provides an interface for reading data from a Readable stream (such as process.stdin) one line at a time. It includes the readline.Interface class with question, on('line'), and close events.

Use cases include building command-line tools, interactive prompts, and REPL-style applications.

Fully supported in Bun

Fully implemented.

Functions 6

  • readline.clearLine()

    The readline.clearLine() method clears current line of given TTY stream in a specified direction identified by dir.

  • readline.clearScreenDown()

    The readline.clearScreenDown() method clears the given TTY stream from the current position of the cursor down.

  • readline.createInterface()

    The readline.createInterface() method creates a new readline.Interface instance.

  • readline.cursorTo()

    The readline.cursorTo() method moves cursor to the specified position in a given TTY stream.

  • readline.emitKeypressEvents()

    The readline.emitKeypressEvents() method causes the given Readable stream to begin emitting 'keypress' events corresponding to received input.

  • readline.moveCursor()

    The readline.moveCursor() method moves the cursor _relative_ to its current position in a given TTY stream.

Classes 1

  • class readline.Interface

    Instances of the readline.Interface class are constructed using the readline.createInterface() method.

Interfaces 4

Types 4

Other 1