Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda