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

119
Views
Return value not fulfilled

I don't understand why the last console.log returns 'Promise { pending }' without any log. When I can see the result when I uncomment the console.log in the GetInfo function. How can I fix that issue and get my records array from GetInfo?

const fs = require("fs")
const { parse } = require("csv-parse")

const processFile = async () => {
  const records = []
  const parser = fs.createReadStream("bom.csv").pipe(
    parse({
      delimiter: ",",
      columns: ["BoMLevel","Level","Item","Desc","Type","Count"],
    })
  )
  for await (const record of parser) {
    records.push(record)
  }
  return records
}

async function GetInfo() {
  const records = await processFile()
  // console.info(records)
  return records
}

console.log(GetInfo())
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You're not awaiting the response of GetInfo.

Either do

GetInfo().then((records) => console.log(records);

or wrap in an async IIFE

(async () => {
  console.log(await GetInfo());
})();

Or just say await GetInfo() if you have top-level await enabled

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