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

190
Visualizações
How to find tmp folder made by nodejs filesystem?

I was using fs to write values from textarea into a file and had issues with the path until I found on stackoverflow that the path has to be a tmp folder. I did that and the terminal shows the function was successful but now I don't know where that folder is and how I can access.

app.post('/scheduleTweet', function (req, res) {
 fs.writeFile('/tmp/scheduleTweet', req.body.text, err => {
  if (err) {
   console.error(err);
  } else{
   console.log("success");
  }
 });
})

Can somebody help me please? I'm self taught so not really sure what to google even.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If the path starts with a /, then fs.writeFile writes to that path on the current drive, for example, to C:/tmp/schedule.txt. Otherwise, it writes relative to the current working directory of the node process. It's easier if you make it relative to the directory containing your Javascript code: fs.writeFile(__dirname + "/tmp/schedule.txt", ...).

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