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

339
Vistas
download multiple images as zip file using javascript in angular

I need to download a list of images using javascript in angular as a zip file.. so my website is an shopping website..if we click on a product it will open allthe images related to it.This is same as we have in amazon and flipkart shopping websites. i had a button and when i click on the button i need to download all the images that are showing when clicked on the respective product. The problem I am facing is that there are no images in the downloaded file. here is the html part

<a class="download" (click) = "download()" >

below is the .ts part and "this.Images" has all the image urls

download(){
let count = 0;
const zip = new JSZip();

this.Images.forEach((item) =>{
  this.fileName = this.getfileName(item);
  JSZipUtils.getBinaryContent(item, (err,data)=>{
    if(err){
      throw err;
    }
    console.log(data);    
    zip.folder("images").file(this.fileName,data,{base64: true});
    count++

    if(count === this.Images.length){
      zip.generateAsync({type:'blob'}).then((content)=>{
          fileSaver.saveAs(content, this.fileName);
      });
    }
  });
});
}

getfiileName() method is as below

getfileName(str){
return str.substring(str.lastIndexOf('/')+1);

}

Note : I dont want to use JSZipUtils in my code

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