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

115
Visualizações
how to make method on wait until all functionality work done in node js

I'm reading csv file and do some processing but with this processing the other method get called and I'm getting error for that. so I want to execute return method after all process done. please help. thanks.

async  function createcsv(data){
try{
const stream = Readable.from(data.buffer)
        const data1 = stream
          .pipe(csv())
          .on("data", async (data) => results.push(data))
          .on("end", async () => {
               //doing some process 
             }
return {
status:"success"
message:"created csv"
file:filename
}
}catch(err){
console.log(err)
}
}

so the return method execute early and I didn't get file name which I'm processing inside stream so I want execute return method at the end and also get the file name because I'me processing thousand of csv file data. please help

about 4 years ago · Juan Pablo Isaza
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