downloads.DownloadQuery

Parameters that combine to specify a predicate that can be used to select a set of downloads. Used for example in downloads.search() and downloads.erase().

Type

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

queryOptional
array of string. This array of search terms limits results to DownloadItems whose filename or url contain all of the search terms that do not begin with a dash '-' and none of the search terms that do begin with a dash.
startedBeforeOptional
downloads.DownloadTime. Limits results to downloads that started before the given ms since the epoch.
startedAfterOptional
downloads.DownloadTime. Limits results to downloads that started after the given ms since the epoch.
endedBeforeOptional
downloads.DownloadTime. Limits results to downloads that ended before the given ms since the epoch.
endedAfterOptional
downloads.DownloadTime. Limits results to downloads that ended after the given ms since the epoch.
totalBytesGreaterOptional
number. Limits results to downloads whose totalBytes is greater than the given integer.
totalBytesLessOptional
number. Limits results to downloads whose totalBytes is less than the given integer.
filenameRegexOptional
string. Limits results to DownloadItems whose filename matches the given regular expression.
urlRegexOptional
string. Limits results to DownloadItems whose url matches the given regular expression.
limitOptional
integer. Setting this integer limits the number of results. Otherwise, all matching DownloadItems will be returned.
orderByOptional
array of string. Setting elements of this array to DownloadItem properties in order to sort the search results. For example, setting orderBy='startTime' sorts the DownloadItems by their start time in ascending order. To specify descending order, prefix orderBy with a hyphen: '-startTime'.
idOptional
integer.
urlOptional
string. Absolute URL.
filenameOptional
string. Absolute local path.
dangerOptional
downloads.DangerType. Indication of whether this download is thought to be safe or known to be suspicious.
mimeOptional
string. The file's MIME type.
startTimeOptional
string.
endTimeOptional
string.
stateOptional
downloads.State. Indicates whether the download is progressing, interrupted, or complete.
pausedOptional
boolean. True if the download has stopped reading data from the host, but kept the connection open.
errorOptional
downloads.InterruptReason. Why a download was interrupted.
bytesReceivedOptional
number. Number of bytes received so far from the host, without considering file compression.
totalBytesOptional
number. Number of bytes in the whole file, without considering file compression, or -1 if unknown.
fileSizeOptional
number. Number of bytes in the whole file post-decompression, or -1 if unknown.
existsOptional
boolean.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?47.0Yes33
Firefox
Basic support48.0

Acknowledgements

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

Document Tags and Contributors

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