When downloading a file, I define the file name like this:

chrome.downloads.onDeterminingFilename.addListener 

But you need to change the folder to save the file. Actually the question is: how can this be done?

    1 answer 1

    The onDeterminingFilename is called with two arguments: the download object and the suggest function, which allows you to set the relative file upload path.
    At the same time, the API does not allow reaching a higher level, but only creating subfolders in the main download directory.

    Example:

     chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) { suggest({ filename: 'my-folder/' + item.filename }); });