Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

114
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda