Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
how to use backspace with process.stdin.setRawMode(true) nodejs

In nodejs when setting process.stdin.setRawMode(true) the console functionalities get disabled but id like to use the backspace key on the output. something like clearline but for chars.

I have tried turning setRawMode() off then turning it on after the backspace action is finished. it worked for all input added AFTER setRawMode() was disabled.

Thanks.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Okay, so I figured out a solution.

stdin.on("data", (data) => {    
    buffer += data;  
    if (data == "\b"){
    buffer = buffer.slice(0, buffer.length-2)
    stdout.clearLine(0);
    stdout.cursorTo(0);
    stdout.write(buffer);
    return;
}

If there is other solutions id appreciate it. Otherwise, this is functional.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!