Skip to content

browser only downloads 10 images at once (JS) [closed]

there is a limit of downloads that can be done at the same time and that limit is 10 how can I change the code so that it allows more than 10 at the same time ?

 transferFiles(){
      this.checkMark = true

  let i = 0
   this.finalImages.forEach((image) =>{
      i++
      saveAs(image, 'imagem'+i);
    
      })
    
  } 
  
  
  }
}

Answer

I’m not sure what you are trying to do, but if there is a restriction on the number of simultaneous downloads, why not try setting a timeout so they don’t fire at the same time?

transferFiles(){
   this.checkMark = true

   let i = 0
   this.finalImages.forEach((image) =>{
       setTimeout(function(){
           saveAs(image, 'imagem'+(i+1));
       }, i++ * 500);
   });
}