Skip to content

Exports

[<Class>]
type Exports =
    static member Interface (options: ReadLineOptions) : Interface
    static member Interface (input: ReadableStream, ?output: WritableStream, ?completer: U2<AsyncCompleter,Completer>, ?terminal: bool) : Interface
    static member Readline (stream: WritableStream, ?options: Options) : Readline
    static member createInterface (options: ReadLineOptions) : Interface
    static member createInterface (input: ReadableStream, ?output: WritableStream, ?completer: Completer, ?terminal: bool) : Interface
AssemblyXantham.Fable.Node
Attributes[<Erase>]

The package's value exports, each bound to its import.

Methods

static member Interface (options: ReadLineOptions) : Interface

Instances of the readlinePromises.Interface class are constructed using the readlinePromises.createInterface() method. Every instance is associated with a single input``Readable stream and a single output``Writable stream. The output stream is used to print prompts for user input that arrives on, and is read from, the input stream.

@since v17.0.0

static member Interface (input: ReadableStream, ?output: WritableStream, ?completer: U2<AsyncCompleter,Completer>, ?terminal: bool) : Interface

Instances of the readlinePromises.Interface class are constructed using the readlinePromises.createInterface() method. Every instance is associated with a single input``Readable stream and a single output``Writable stream. The output stream is used to print prompts for user input that arrives on, and is read from, the input stream.

@since v17.0.0

static member Readline (stream: WritableStream, ?options: Options) : Readline

@since v17.0.0

static member createInterface (options: ReadLineOptions) : Interface

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

import readlinePromises from 'node:readline/promises';
const rl = readlinePromises.createInterface({
input: process.stdin,
output: process.stdout,
});

Once the readlinePromises.Interface instance is created, the most common case is to listen for the 'line' event:

rl.on('line', (line) => {
console.log(`Received: ${line}`);
});

If terminal is true for this instance then the output stream will get the best compatibility if it defines an output.columns property and emits a 'resize' event on the output if or when the columns ever change (process.stdout does this automatically when it is a TTY).

@since v17.0.0

static member createInterface (input: ReadableStream, ?output: WritableStream, ?completer: Completer, ?terminal: bool) : Interface

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

import readlinePromises from 'node:readline/promises';
const rl = readlinePromises.createInterface({
input: process.stdin,
output: process.stdout,
});

Once the readlinePromises.Interface instance is created, the most common case is to listen for the 'line' event:

rl.on('line', (line) => {
console.log(`Received: ${line}`);
});

If terminal is true for this instance then the output stream will get the best compatibility if it defines an output.columns property and emits a 'resize' event on the output if or when the columns ever change (process.stdout does this automatically when it is a TTY).

@since v17.0.0