Gaunt Sloth Assistant
    Preparing search index...

    Interface ReadLineInterface

    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.

    v17.0.0

    interface ReadLineInterface {
        cursor: number;
        line: string;
        terminal: boolean;
        "[asyncIterator]"(): AsyncIterator<string>;
        "[captureRejectionSymbol]"<K>(
            error: Error,
            event: string | symbol,
            ...args: AnyRest,
        ): void;
        "[dispose]"(): void;
        addListener(event: string, listener: (...args: any[]) => void): this;
        addListener(event: "close", listener: () => void): this;
        addListener(event: "line", listener: (input: string) => void): this;
        addListener(event: "pause", listener: () => void): this;
        addListener(event: "resume", listener: () => void): this;
        addListener(event: "SIGCONT", listener: () => void): this;
        addListener(event: "SIGINT", listener: () => void): this;
        addListener(event: "SIGTSTP", listener: () => void): this;
        addListener(event: "history", listener: (history: string[]) => void): this;
        close(): void;
        emit(event: string | symbol, ...args: any[]): boolean;
        emit(event: "close"): boolean;
        emit(event: "line", input: string): boolean;
        emit(event: "pause"): boolean;
        emit(event: "resume"): boolean;
        emit(event: "SIGCONT"): boolean;
        emit(event: "SIGINT"): boolean;
        emit(event: "SIGTSTP"): boolean;
        emit(event: "history", history: string[]): boolean;
        eventNames(): (string | symbol)[];
        getCursorPos(): CursorPos;
        getMaxListeners(): number;
        getPrompt(): string;
        listenerCount<K>(eventName: string | symbol, listener?: Function): number;
        listeners<K>(eventName: string | symbol): Function[];
        off<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        on(event: string, listener: (...args: any[]) => void): this;
        on(event: "close", listener: () => void): this;
        on(event: "line", listener: (input: string) => void): this;
        on(event: "pause", listener: () => void): this;
        on(event: "resume", listener: () => void): this;
        on(event: "SIGCONT", listener: () => void): this;
        on(event: "SIGINT", listener: () => void): this;
        on(event: "SIGTSTP", listener: () => void): this;
        on(event: "history", listener: (history: string[]) => void): this;
        once(event: string, listener: (...args: any[]) => void): this;
        once(event: "close", listener: () => void): this;
        once(event: "line", listener: (input: string) => void): this;
        once(event: "pause", listener: () => void): this;
        once(event: "resume", listener: () => void): this;
        once(event: "SIGCONT", listener: () => void): this;
        once(event: "SIGINT", listener: () => void): this;
        once(event: "SIGTSTP", listener: () => void): this;
        once(event: "history", listener: (history: string[]) => void): this;
        pause(): this;
        prependListener(event: string, listener: (...args: any[]) => void): this;
        prependListener(event: "close", listener: () => void): this;
        prependListener(event: "line", listener: (input: string) => void): this;
        prependListener(event: "pause", listener: () => void): this;
        prependListener(event: "resume", listener: () => void): this;
        prependListener(event: "SIGCONT", listener: () => void): this;
        prependListener(event: "SIGINT", listener: () => void): this;
        prependListener(event: "SIGTSTP", listener: () => void): this;
        prependListener(
            event: "history",
            listener: (history: string[]) => void,
        ): this;
        prependOnceListener(
            event: string,
            listener: (...args: any[]) => void,
        ): this;
        prependOnceListener(event: "close", listener: () => void): this;
        prependOnceListener(event: "line", listener: (input: string) => void): this;
        prependOnceListener(event: "pause", listener: () => void): this;
        prependOnceListener(event: "resume", listener: () => void): this;
        prependOnceListener(event: "SIGCONT", listener: () => void): this;
        prependOnceListener(event: "SIGINT", listener: () => void): this;
        prependOnceListener(event: "SIGTSTP", listener: () => void): this;
        prependOnceListener(
            event: "history",
            listener: (history: string[]) => void,
        ): this;
        prompt(preserveCursor?: boolean): void;
        question(query: string): Promise<string>;
        question(query: string, options: Abortable): Promise<string>;
        rawListeners<K>(eventName: string | symbol): Function[];
        removeAllListeners(eventName?: string | symbol): this;
        removeListener<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        resume(): this;
        setMaxListeners(n: number): this;
        setPrompt(prompt: string): void;
        write(data: string | Buffer<ArrayBufferLike>, key?: Key): void;
        write(
            data: undefined | null | string | Buffer<ArrayBufferLike>,
            key: Key,
        ): void;
    }

    Hierarchy

    • Interface
      • ReadLineInterface
    Index

    Properties

    cursor: number

    The cursor position relative to rl.line.

    This will track where the current cursor lands in the input string, when reading input from a TTY stream. The position of cursor determines the portion of the input string that will be modified as input is processed, as well as the column where the terminal caret will be rendered.

    v0.1.98

    line: string

    The current input data being processed by node.

    This can be used when collecting input from a TTY stream to retrieve the current value that has been processed thus far, prior to the line event being emitted. Once the line event has been emitted, this property will be an empty string.

    Be aware that modifying the value during the instance runtime may have unintended consequences if rl.cursor is not also controlled.

    If not using a TTY stream for input, use the 'line' event.

    One possible use case would be as follows:

    const values = ['lorem ipsum', 'dolor sit amet'];
    const rl = readline.createInterface(process.stdin);
    const showResults = debounce(() => {
    console.log(
    '\n',
    values.filter((val) => val.startsWith(rl.line)).join(' '),
    );
    }, 300);
    process.stdin.on('keypress', (c, k) => {
    showResults();
    });

    v0.1.98

    terminal: boolean

    Methods

    • Returns AsyncIterator<string>

    • Type Parameters

      • K

      Parameters

      • error: Error
      • event: string | symbol
      • ...args: AnyRest

      Returns void

    • Alias for rl.close().

      Returns void

      v22.15.0

    • events.EventEmitter

      1. close
      2. line
      3. pause
      4. resume
      5. SIGCONT
      6. SIGINT
      7. SIGTSTP
      8. history

      Parameters

      • event: string
      • listener: (...args: any[]) => void

      Returns this

    • events.EventEmitter

      1. close
      2. line
      3. pause
      4. resume
      5. SIGCONT
      6. SIGINT
      7. SIGTSTP
      8. history

      Parameters

      • event: "close"
      • listener: () => void

      Returns this

    • events.EventEmitter

      1. close
      2. line
      3. pause
      4. resume
      5. SIGCONT
      6. SIGINT
      7. SIGTSTP
      8. history

      Parameters

      • event: "line"
      • listener: (input: string) => void

      Returns this

    • events.EventEmitter

      1. close
      2. line
      3. pause
      4. resume
      5. SIGCONT
      6. SIGINT
      7. SIGTSTP
      8. history

      Parameters

      • event: "pause"
      • listener: () => void

      Returns this

    • events.EventEmitter

      1. close
      2. line
      3. pause
      4. resume
      5. SIGCONT
      6. SIGINT
      7. SIGTSTP
      8. history

      Parameters

      • event: "resume"
      • listener: () => void

      Returns this

    • events.EventEmitter

      1. close
      2. line
      3. pause
      4. resume
      5. SIGCONT
      6. SIGINT
      7. SIGTSTP
      8. history

      Parameters

      • event: "SIGCONT"
      • listener: () => void

      Returns this

    • events.EventEmitter

      1. close
      2. line
      3. pause
      4. resume
      5. SIGCONT
      6. SIGINT
      7. SIGTSTP
      8. history

      Parameters

      • event: "SIGINT"
      • listener: () => void

      Returns this

    • events.EventEmitter

      1. close
      2. line
      3. pause
      4. resume
      5. SIGCONT
      6. SIGINT
      7. SIGTSTP
      8. history

      Parameters

      • event: "SIGTSTP"
      • listener: () => void

      Returns this

    • events.EventEmitter

      1. close
      2. line
      3. pause
      4. resume
      5. SIGCONT
      6. SIGINT
      7. SIGTSTP
      8. history

      Parameters

      • event: "history"
      • listener: (history: string[]) => void

      Returns this

    • The rl.close() method closes the Interface instance and relinquishes control over the input and output streams. When called, the 'close' event will be emitted.

      Calling rl.close() does not immediately stop other events (including 'line') from being emitted by the Interface instance.

      Returns void

      v0.1.98

    • Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

      Returns true if the event had listeners, false otherwise.

      import { EventEmitter } from 'node:events';
      const myEmitter = new EventEmitter();

      // First listener
      myEmitter.on('event', function firstListener() {
      console.log('Helloooo! first listener');
      });
      // Second listener
      myEmitter.on('event', function secondListener(arg1, arg2) {
      console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
      });
      // Third listener
      myEmitter.on('event', function thirdListener(...args) {
      const parameters = args.join(', ');
      console.log(`event with parameters ${parameters} in third listener`);
      });

      console.log(myEmitter.listeners('event'));

      myEmitter.emit('event', 1, 2, 3, 4, 5);

      // Prints:
      // [
      // [Function: firstListener],
      // [Function: secondListener],
      // [Function: thirdListener]
      // ]
      // Helloooo! first listener
      // event with parameters 1, 2 in second listener
      // event with parameters 1, 2, 3, 4, 5 in third listener

      Parameters

      • event: string | symbol
      • ...args: any[]

      Returns boolean

      v0.1.26

    • Parameters

      • event: "close"

      Returns boolean

    • Parameters

      • event: "line"
      • input: string

      Returns boolean

    • Parameters

      • event: "pause"

      Returns boolean

    • Parameters

      • event: "resume"

      Returns boolean

    • Parameters

      • event: "SIGCONT"

      Returns boolean

    • Parameters

      • event: "SIGINT"

      Returns boolean

    • Parameters

      • event: "SIGTSTP"

      Returns boolean

    • Parameters

      • event: "history"
      • history: string[]

      Returns boolean

    • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

      import { EventEmitter } from 'node:events';

      const myEE = new EventEmitter();
      myEE.on('foo', () => {});
      myEE.on('bar', () => {});

      const sym = Symbol('symbol');
      myEE.on(sym, () => {});

      console.log(myEE.eventNames());
      // Prints: [ 'foo', 'bar', Symbol(symbol) ]

      Returns (string | symbol)[]

      v6.0.0

    • Returns the real position of the cursor in relation to the input prompt + string. Long input (wrapping) strings, as well as multiple line prompts are included in the calculations.

      Returns CursorPos

      v13.5.0, v12.16.0

    • Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.

      Returns number

      v1.0.0

    • The rl.getPrompt() method returns the current prompt used by rl.prompt().

      Returns string

      the current prompt string

      v15.3.0, v14.17.0

    • Returns the number of listeners listening for the event named eventName. If listener is provided, it will return how many times the listener is found in the list of the listeners of the event.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event being listened for

      • Optionallistener: Function

        The event handler function

      Returns number

      v3.2.0

    • Returns a copy of the array of listeners for the event named eventName.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });
      console.log(util.inspect(server.listeners('connection')));
      // Prints: [ [Function] ]

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      v0.1.26

    • Alias for emitter.removeListener().

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: (...args: any[]) => void

      Returns this

      v10.0.0

    • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.on('foo', () => console.log('a'));
      myEE.prependListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a

      Parameters

      • event: string
      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v0.1.101

    • Parameters

      • event: "close"
      • listener: () => void

      Returns this

    • Parameters

      • event: "line"
      • listener: (input: string) => void

      Returns this

    • Parameters

      • event: "pause"
      • listener: () => void

      Returns this

    • Parameters

      • event: "resume"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGCONT"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGINT"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGTSTP"
      • listener: () => void

      Returns this

    • Parameters

      • event: "history"
      • listener: (history: string[]) => void

      Returns this

    • Adds a one-time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

      server.once('connection', (stream) => {
      console.log('Ah, we have our first user!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.once('foo', () => console.log('a'));
      myEE.prependOnceListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a

      Parameters

      • event: string
      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v0.3.0

    • Parameters

      • event: "close"
      • listener: () => void

      Returns this

    • Parameters

      • event: "line"
      • listener: (input: string) => void

      Returns this

    • Parameters

      • event: "pause"
      • listener: () => void

      Returns this

    • Parameters

      • event: "resume"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGCONT"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGINT"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGTSTP"
      • listener: () => void

      Returns this

    • Parameters

      • event: "history"
      • listener: (history: string[]) => void

      Returns this

    • The rl.pause() method pauses the input stream, allowing it to be resumed later if necessary.

      Calling rl.pause() does not immediately pause other events (including 'line') from being emitted by the Interface instance.

      Returns this

      v0.3.4

    • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

      server.prependListener('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      Parameters

      • event: string
      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v6.0.0

    • Parameters

      • event: "close"
      • listener: () => void

      Returns this

    • Parameters

      • event: "line"
      • listener: (input: string) => void

      Returns this

    • Parameters

      • event: "pause"
      • listener: () => void

      Returns this

    • Parameters

      • event: "resume"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGCONT"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGINT"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGTSTP"
      • listener: () => void

      Returns this

    • Parameters

      • event: "history"
      • listener: (history: string[]) => void

      Returns this

    • Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

      server.prependOnceListener('connection', (stream) => {
      console.log('Ah, we have our first user!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      Parameters

      • event: string
      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v6.0.0

    • Parameters

      • event: "close"
      • listener: () => void

      Returns this

    • Parameters

      • event: "line"
      • listener: (input: string) => void

      Returns this

    • Parameters

      • event: "pause"
      • listener: () => void

      Returns this

    • Parameters

      • event: "resume"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGCONT"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGINT"
      • listener: () => void

      Returns this

    • Parameters

      • event: "SIGTSTP"
      • listener: () => void

      Returns this

    • Parameters

      • event: "history"
      • listener: (history: string[]) => void

      Returns this

    • The rl.prompt() method writes the Interface instances configuredprompt to a new line in output in order to provide a user with a new location at which to provide input.

      When called, rl.prompt() will resume the input stream if it has been paused.

      If the Interface was created with output set to null or undefined the prompt is not written.

      Parameters

      • OptionalpreserveCursor: boolean

        If true, prevents the cursor placement from being reset to 0.

      Returns void

      v0.1.98

    • The rl.question() method displays the query by writing it to the output, waits for user input to be provided on input, then invokes the callback function passing the provided input as the first argument.

      When called, rl.question() will resume the input stream if it has been paused.

      If the Interface was created with output set to null or undefined the query is not written.

      If the question is called after rl.close(), it returns a rejected promise.

      Example usage:

      const answer = await rl.question('What is your favorite food? ');
      console.log(`Oh, so your favorite food is ${answer}`);

      Using an AbortSignal to cancel a question.

      const signal = AbortSignal.timeout(10_000);

      signal.addEventListener('abort', () => {
      console.log('The food question timed out');
      }, { once: true });

      const answer = await rl.question('What is your favorite food? ', { signal });
      console.log(`Oh, so your favorite food is ${answer}`);

      Parameters

      • query: string

        A statement or query to write to output, prepended to the prompt.

      Returns Promise<string>

      A promise that is fulfilled with the user's input in response to the query.

      v17.0.0

    • The rl.question() method displays the query by writing it to the output, waits for user input to be provided on input, then invokes the callback function passing the provided input as the first argument.

      When called, rl.question() will resume the input stream if it has been paused.

      If the Interface was created with output set to null or undefined the query is not written.

      If the question is called after rl.close(), it returns a rejected promise.

      Example usage:

      const answer = await rl.question('What is your favorite food? ');
      console.log(`Oh, so your favorite food is ${answer}`);

      Using an AbortSignal to cancel a question.

      const signal = AbortSignal.timeout(10_000);

      signal.addEventListener('abort', () => {
      console.log('The food question timed out');
      }, { once: true });

      const answer = await rl.question('What is your favorite food? ', { signal });
      console.log(`Oh, so your favorite food is ${answer}`);

      Parameters

      • query: string

        A statement or query to write to output, prepended to the prompt.

      • options: Abortable

      Returns Promise<string>

      A promise that is fulfilled with the user's input in response to the query.

      v17.0.0

    • Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

      import { EventEmitter } from 'node:events';
      const emitter = new EventEmitter();
      emitter.once('log', () => console.log('log once'));

      // Returns a new Array with a function `onceWrapper` which has a property
      // `listener` which contains the original listener bound above
      const listeners = emitter.rawListeners('log');
      const logFnWrapper = listeners[0];

      // Logs "log once" to the console and does not unbind the `once` event
      logFnWrapper.listener();

      // Logs "log once" to the console and removes the listener
      logFnWrapper();

      emitter.on('log', () => console.log('log persistently'));
      // Will return a new Array with a single function bound by `.on()` above
      const newListeners = emitter.rawListeners('log');

      // Logs "log persistently" twice
      newListeners[0]();
      emitter.emit('log');

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      v9.4.0

    • Removes all listeners, or those of the specified eventName.

      It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

      Returns a reference to the EventEmitter, so that calls can be chained.

      Parameters

      • OptionaleventName: string | symbol

      Returns this

      v0.1.26

    • Removes the specified listener from the listener array for the event named eventName.

      const callback = (stream) => {
      console.log('someone connected!');
      };
      server.on('connection', callback);
      // ...
      server.removeListener('connection', callback);

      removeListener() will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified eventName, then removeListener() must be called multiple times to remove each instance.

      Once an event is emitted, all listeners attached to it at the time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution will not remove them fromemit() in progress. Subsequent events behave as expected.

      import { EventEmitter } from 'node:events';
      class MyEmitter extends EventEmitter {}
      const myEmitter = new MyEmitter();

      const callbackA = () => {
      console.log('A');
      myEmitter.removeListener('event', callbackB);
      };

      const callbackB = () => {
      console.log('B');
      };

      myEmitter.on('event', callbackA);

      myEmitter.on('event', callbackB);

      // callbackA removes listener callbackB but it will still be called.
      // Internal listener array at time of emit [callbackA, callbackB]
      myEmitter.emit('event');
      // Prints:
      // A
      // B

      // callbackB is now removed.
      // Internal listener array [callbackA]
      myEmitter.emit('event');
      // Prints:
      // A

      Because listeners are managed using an internal array, calling this will change the position indices of any listener registered after the listener being removed. This will not impact the order in which listeners are called, but it means that any copies of the listener array as returned by the emitter.listeners() method will need to be recreated.

      When a single function has been added as a handler multiple times for a single event (as in the example below), removeListener() will remove the most recently added instance. In the example the once('ping') listener is removed:

      import { EventEmitter } from 'node:events';
      const ee = new EventEmitter();

      function pong() {
      console.log('pong');
      }

      ee.on('ping', pong);
      ee.once('ping', pong);
      ee.removeListener('ping', pong);

      ee.emit('ping');
      ee.emit('ping');

      Returns a reference to the EventEmitter, so that calls can be chained.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: (...args: any[]) => void

      Returns this

      v0.1.26

    • The rl.resume() method resumes the input stream if it has been paused.

      Returns this

      v0.3.4

    • By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

      Returns a reference to the EventEmitter, so that calls can be chained.

      Parameters

      • n: number

      Returns this

      v0.3.5

    • The rl.setPrompt() method sets the prompt that will be written to output whenever rl.prompt() is called.

      Parameters

      • prompt: string

      Returns void

      v0.1.98

    • The rl.write() method will write either data or a key sequence identified by key to the output. The key argument is supported only if output is a TTY text terminal. See TTY keybindings for a list of key combinations.

      If key is specified, data is ignored.

      When called, rl.write() will resume the input stream if it has been paused.

      If the Interface was created with output set to null or undefined the data and key are not written.

      rl.write('Delete this!');
      // Simulate Ctrl+U to delete the line written previously
      rl.write(null, { ctrl: true, name: 'u' });

      The rl.write() method will write the data to the readline Interface's input as if it were provided by the user.

      Parameters

      • data: string | Buffer<ArrayBufferLike>
      • Optionalkey: Key

      Returns void

      v0.1.98

    • The rl.write() method will write either data or a key sequence identified by key to the output. The key argument is supported only if output is a TTY text terminal. See TTY keybindings for a list of key combinations.

      If key is specified, data is ignored.

      When called, rl.write() will resume the input stream if it has been paused.

      If the Interface was created with output set to null or undefined the data and key are not written.

      rl.write('Delete this!');
      // Simulate Ctrl+U to delete the line written previously
      rl.write(null, { ctrl: true, name: 'u' });

      The rl.write() method will write the data to the readline Interface's input as if it were provided by the user.

      Parameters

      • data: undefined | null | string | Buffer<ArrayBufferLike>
      • key: Key

      Returns void

      v0.1.98