{ } qjs-modules

readlinePromises

Source: lib/readlinePromises.js — compiled into qjsm; imported as readline/promises

Node's readline/promises (also Bun's and Deno's): the readline interface with a promise-returning question(). See readline for inputs and events.

import { createInterface } from 'readline/promises';

const rl = createInterface({ input: process.stdin, output: process.stdout });
const name = await rl.question('name? ');
rl.close();
ExportDescription
createInterface(...)as in readline, returning an Interface of this module
Interfacequestion(query, { signal }) resolves with the answer

An aborted signal rejects with an AbortError (code: 'ABORT_ERR'). Closing the interface leaves a pending question() unsettled, as in Node. Readline (batched cursor commands) is not implemented.

Export list

Generated by utilities/doc-api.js from the readlinePromises dump of utilities/api-surface.sh: 7 members. Edit the text above this block, not the block.

Functions: createInterface()

Interface

class, constructible

  • methods: question()

default

object

  • static methods: Interface(), createInterface()