downloads.DownloadItem

The DownloadItem type of the downloads API represents a downloaded file.

Type

Values of this type are objects. They contain the following properties:

id
An integer representing a unique identifier for the downloaded file that is persistent across browser sessions.
url
A string representing the absolute URL from which the file was downloaded.
referrer
A string representing the downloaded file's referrer.
filename
A string representing the file's absolute local path.
incognito
A boolean that indicates whether the download is recorded in the browser's history (false), or not (true).
danger
A string indicating whether this download is thought to be safe or known to be suspicious. Its possible values are defined in the downloads.DangerType type.
mime
A string representing the downloaded file's MIME type.
startTime
A string (in ISO 8601 format) representing the number of milliseconds between the UNIX epoch and when this download began.
endTimeOptional
A string (in ISO 8601 format) representing the number of milliseconds between the UNIX epoch and when this download ended.
estimatedEndTimeOptional
A string (in ISO 8601 format) representing the estimated number of milliseconds between the UNIX epoch and when this download ended.
state
A string Indicating whether the download is progressing, interrupted, or complete. Possible values are defined in the downloads.State type.
paused
A boolean indicating whether the download is paused, i.e. if the download has stopped reading data from the host but has kept the connection open. If so, the value is true, false if not.
canResume
A boolean indicating whether a currently-interrupted (e.g. paused) download can be resumed from the point where it was interrupted (true), or not (false).
errorOptional
A string indicating why a download was interrupted. Possible values are defined in the downloads.InterruptReason type.
bytesReceived
A number representing the number of bytes received so far from the host during the download; this does not take file compression into consideration.
totalBytes
A number indicating the total number of bytes in the file being downloaded. This does not take file compression into consideration. A value of -1 here means that the total number of bytes is unknown.
fileSize
A number indicating the total number of bytes in the whole file, after decompression. A value of -1 here means that the total file size is unknown.
exists
A boolean indicating whether a downloaded file still exists (true) or not (false). This information might be out-of-date, as browsers do not automatically watch for file removal — to check whether a file exists, call the downloads.search() method, filtering for the file in question.
byExtensionIdOptional
A string representing the ID of the add-on that triggered the download (if it was triggered by an add-on.) This does not change once set.
byExtensionNameOptional
A string representing the name of the add-on that triggered the download (if it was triggered by an add-on.) This may change if the add-on changes its name or the user changes their locale.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic Support Yes No 47.0 48.0 33

Acknowledgements

This API is based on Chromium's chrome.downloads API.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: wbamberg, chrisdavidmills
 Last updated by: wbamberg,