The HTTP method to use if the URL uses the HTTP[S] protocol.
file: The download's filename is suspicious. url: The download's URL is known to be malicious. content: The downloaded file is known to be malicious. uncommon: The download's URL is not commonly downloaded and could be dangerous. safe: The download presents no known danger to the user's computer.
These string constants will never change, however the set of DangerTypes may change.
A time specified as a Date object, a number or string representing milliseconds since the epoch, or an ISO 8601 string
in_progress: The download is currently receiving data from the server. interrupted: An error broke the connection with the file host. complete: The download completed successfully.
These string constants will never change, however the set of States may change.
ConstonWhen any of a DownloadItem's properties except bytesReceived changes, this event fires with the downloadId and an object containing the properties that changed.
ConstonThis event fires with the DownloadItem object when a download begins.
ConstonFires with the downloadId when a download is erased from history.
Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore.
The id of the download to cancel.
Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename. If the download started successfully, callback will be called with the new DownloadItem's downloadId. If there was an error starting the download, then callback will be called with downloadId=undefined and browser.extension.lastError will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. You must not parse it.
What to download and how.
Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, browser.extension.lastError will contain an error message.
The identifier for the download.
Optionaloptions: _GetFileIconOptionsOpen the downloaded file.
Pause the download. If the request was successful the download is in a paused state. Otherwise browser.extension.lastError contains an error message. The request will fail if the download is not active.
The id of the download to pause.
Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise browser.extension.lastError contains an error message. The request will fail if the download is not active.
The id of the download to resume.
Find DownloadItems. Set query to the empty object to get all DownloadItems. To get a specific DownloadItem, set only the id field.
Show the downloaded file in its folder in a file manager.
Permissions:
downloadsNot allowed in: Content scripts, Devtools pages