• {string|undefined}

    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:

    1. const values = ['lorem ipsum', 'dolor sit amet'];
    2. const rl = readline.createInterface(process.stdin);
    3. const showResults = debounce(() => {
    4. console.log(
    5. '\n',
    6. values.filter((val) => val.startsWith(rl.line)).join(' ')
    7. );
    8. }, 300);
    9. process.stdin.on('keypress', (c, k) => {
    10. showResults();
    11. });