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

274
Views
ReadLine nodejs: don't return values

I'm trying to retun number of my element that i research in a file but result of my return is undefined

function verifFile(file, element) {
var nb_element = 0;
var lectf = readline.createInterface({
    input: fs.createReadStream(file),
    console: false
});

lectf.on('line', function (line) {
    if (line.trim() != "") {        
        if (line.substring(N1, N2) == element) {
            nb_element++;
        }
    }
});
lectf.on('close', function () { 
    if (nombre_ligne_n == 0) {
        return nb_element;
    }
});

}test = verifFile(pathfile, element); ressult test is undefined

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!