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

337
Views
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
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!