How to remember last download location when calling chrome.downloads.download? (Extension Developer)

It's concerning that Chrome actually doesn't provide the ability for an extension to get the last download path. Some say, it's due to security concern and others say, there is no significant need to have the API available to users.

You also cannot store the download path in your extension because Chrome doesn't let you get the selected download folder. I hope Google provides us with the either of these features later.


This is not a supported feature, according to this Chromium discussion.

Summary:

  1. If you specify a filename, it's never possible to save outside of ~/Downloads (this is a bummer, for me)
  2. You should be able to manually implement something (in a subfolder only) using the id returned from Chrome.downloads.download

A few quotes I like (edited for brevity and politeness):

Would like a download option to choose recent download folder. Would be good to remember last download location per website, like you other settings.

Seems reasonable.

Chrome does remember the last chosen directory if no filename is specified to downloads.download with Save As... Given how Save As works without specifying a filename, my intuition would be it would work the same with a filename... but it doesn't.

That one is interesting. So it kind of supports it already. There's no security concern with saving outside of Downloads.