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

113
Views
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
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!