Created
January 29, 2021 14:42
-
-
Save facugon/b995ff34e9fcdcaff7650f7372f13ce9 to your computer and use it in GitHub Desktop.
force web download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page.evaluate( () => { | |
function onStartedDownload(id) { | |
console.log(`Started downloading: ${id}`); | |
} | |
function onFailed(error) { | |
console.log(`Download failed: ${error}`); | |
} | |
var downloadUrl = "https://example.org/image.png"; | |
var downloading = browser.downloads.download({ | |
url : downloadUrl, | |
filename : 'my-image-again.png', | |
conflictAction : 'uniquify' | |
}); | |
downloading.then(onStartedDownload, onFailed); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment