Posts

Showing posts from July, 2025

Node Js Terminal Password Input

Image
  const getPassword = ( question = " Enter your Password: ") => {     let pass = "";     process . stdout . write ( question );     return new Promise (( reslove , reject ) => {       // Setup raw terminal input       process . stdin . setRawMode ( true );       process . stdin . setEncoding (' utf8 ');       process . stdin . resume ();       process . stdin . on (' data ', ( e ) => {         if ( e == " \u0003 ") {           process . exit ( 0 )         }         if ( e . startsWith (' \u001b ')) return ;         else if ( e == " \r ") {           console . log ("");           process . stdin . setRawMode ( false );           process . stdin . pause ();     ...