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

163
Views
packaging base64 png with client-zip js

I am trying to package several png data in base64 format.

The code runs on the client, and it is supposed to generate a zip file for download with png files. The code below works fine except that all the png in the zip are "corrupt".

I gather that they are not in the right format when they are passed to the client-zip. Though I have not been able to find how to convert and pack them in the right way, also including the metadata as in the text examples I found online.

What is the right way of converting and packaging these files?

Staring the obvious, below, each variable content holds a string of the form:

"data:image/png;base64,iVBORw0KGgoAA..."

function addImageData(index){
    let fileName = "file_".concat(timePoints[index].concat(".png"));
    let content = o.png();
    snapshotArray.push({ name: fileName, 
                        lastModified: new Date(), 
                        input: content });
}


async function downloadMyZip() {
    const blob = await downloadZip(snapshotArray).blob()
    
    const link = document.createElement("a")
    link.href = URL.createObjectURL(blob)
    var today = new Date();
    link.download = "images_".concat(today.toString()).concat(".zip")
    link.click()
    link.remove()
  }
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!