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

160
Views
Jump to next line after writing a word in a file

user_bw = message.content;
fs.writeFile("badwordlog.txt", user_bw, (err) => {
  if (err)
    console.log(err);
  else {
    console.log("badwordlog edited !");
       
  }
});

I need to store all the badwords in a file . How to print the next word in the next line? I tried \n but it was not working.

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

0

The reason for this is that writeFile will replace the whole file. You can pass in a option flag which tells it to append new text to it. You may try:

user_bw = message.content;
fs.writeFile("badwordlog.txt", user_bw, { flag: "a+" }, (err) => {
  if (err)
    console.log(err);
  else {
    console.log("badwordlog edited !");
       
  }
});
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!