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

156
Views
event stream node js large text file read doesn't wait for call back
function readFile()
{
 return new Promise(function (resolve, reject) {
 let totalLines = 0;
 var s=fs.createReadStream("/var/www/uploads/"+filename);
 s.pipe(es.split())
 .pipe(
    es.map(function (line, cb) {
        cb(customFunction(line))
    })
        .on("error", function (err) {
            reject(err);
        })
        .on("end", function () { 
          resolve("ok");
        })
);
})
}

function customFuntion(line){
async()=>{
var res=await redisClient.get(line);
console.log(res)  
}();
}

i am reading a large test file using createReadstream and event stream the issue i am facing is i want to check each number at line in redis but the read file get completed before my console.log in my custom function

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!