Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda