Readline - Node documentation
class Readline

Usage in Deno

import { Readline } from "node:readline/promises";

Constructors

new
Readline(
stream: WritableStream,
options?: { autoCommit?: boolean; },
)

Methods

clearLine(dir: Direction): this

The rl.clearLine() method adds to the internal list of pending action an action that clears current line of the associated stream in a specified direction identified by dir. Call rl.commit() to see the effect of this method, unless autoCommit: truewas passed to the constructor.

The rl.clearScreenDown() method adds to the internal list of pending action an action that clears the associated stream from the current position of the cursor down. Call rl.commit() to see the effect of this method, unless autoCommit: truewas passed to the constructor.

commit(): Promise<void>

The rl.commit() method sends all the pending actions to the associatedstream and clears the internal list of pending actions.

cursorTo(
x: number,
y?: number,
): this

The rl.cursorTo() method adds to the internal list of pending action an action that moves cursor to the specified position in the associated stream. Call rl.commit() to see the effect of this method, unless autoCommit: truewas passed to the constructor.

moveCursor(
dx: number,
dy: number,
): this

The rl.moveCursor() method adds to the internal list of pending action an action that moves the cursor relative to its current position in the associated stream. Call rl.commit() to see the effect of this method, unless autoCommit: truewas passed to the constructor.

rollback(): this

The rl.rollback methods clears the internal list of pending actions without sending it to the associated stream.