0

Hello I am trying to build a chrome extension for downloading multiple images in folder.

chrome.runtime.onMessage.addListener( (request, sender, sendResponse ) => {
if ( request.action === "download") {
    for (let i = 0; i < request.data.length; i++) {
        chrome.downloads.download({url: request.data[i].src})
    }
    sendResponse("Done")
   }
 })

this downloads every URL separately. my goal is to have the user download one folder with all URL's

Adi Elron
  • 37
  • 6
  • What you want to know is how can the extension create a folder under the downloads folder and change it to the default downloads folder? – Norio Yamamoto Oct 19 '22 at 01:56
  • 1
    Use `filename` parameter like 'foo/' + namePortionOfEachUrl – wOxxOm Oct 19 '22 at 06:51
  • @NorioYamamoto no I want the user to download a folder that's containing each and every URL, currently each URL is downloaded separately and you get about 80 URLs in the Downloads folder – Adi Elron Oct 19 '22 at 11:53
  • Is it that your loop triggers the file chooser (so the user can select a location) on every iteration of the loop? If that's true, I'm guessing you want the chooser to only appear one time and put all the files in the same location. Have I got this right? – StormyKnight Oct 20 '22 at 15:25

0 Answers0