Hide password entry from Node.js to console

Asked 2 years ago, Updated 2 years ago, 150 views

Hi, how are you?

Use the readline-sync package (https://www.npmjs.com/package/readline-sync) Use the code below to enter a password in the console, but you want to hide it with *ten thousand There is an unknown error. Please help me.

Code:

const readlineSync = require('readline-sync');
const message = 'Please enter password: ';
const options = {
    hideEchoBack: true,
    mask: '*'
};
const answer = readlineSync.question(message, options);
console.log('Password entered: ', answer);

Error:

C:\Program Files\JetBrains\WebStorm 2018.2.5\bin\runnerw.exe[12932]: src\node_file.cc:1599: Assertion `args[1]->IsInt32()' failed.

 1: 00007FF63765ECE5
 2: 00007FF637638196
 3: 00007FF637638261
 4: 00007FF6375FD557
 5: 00007FF637E62E52
 6: 00007FF637E642ED
 7: 00007FF637E63349
 8: 00007FF637E6322B
 9: 000003AD32F5C5C1

Process finished with exit code 134

Reference:

node version: v10.13.0
readline-sync version: 1.4.9

node.js input readline-sync

2022-09-21 21:33

1 Answers

I know what you mean. It works fine on cmd. I think it's because the package is not compatible with the Webstorm console I write with IDE.


2022-09-21 21:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.