Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda