Skip to content

Instantly share code, notes, and snippets.

@holaontiveros
Created January 19, 2019 01:16
Show Gist options
  • Save holaontiveros/26859e4d13fa69545b3f1a2fc2e35315 to your computer and use it in GitHub Desktop.
Save holaontiveros/26859e4d13fa69545b3f1a2fc2e35315 to your computer and use it in GitHub Desktop.
Function to download a bunch of images from an array of urls
const downLoadImages = (links, title = 'img') => {
links.forEach((element, i) => {
const a = document.createElement('a');
a.setAttribute('href', element);
a.setAttribute('download', `${title}_${i}.png`);
document.body.appendChild(a);
a.click();
a.remove();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment