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

103
Views
For each await push into global variable returns undefined

My code below loops through a zip file called a global variable zipArray, then adds the file contents into zipFileArray. However, when I console.log(zipFileArray) it returns undefined:

        await zip.forEach(async (relativePath: any, file: any) => {
            zipArray.push(file)
        })
        console.log(zipArray)
        var zipFileArray: any[] = []
        await zipArray.forEach(async (file: any) => {
           console.log("reached")
            const file2 = await zip.file(file.name).async("string")
            zipFileArray.push(file2)
        })
        console.log("zipFileArray:" + zipFileArray)
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!