Movatterモバイル変換


[0]ホーム

URL:


  1. Mozilla
  2. Add-ons
  3. Browser extensions
  4. JavaScript APIs
  5. downloads
  6. downloads.DownloadQuery

downloads.DownloadQuery

TheDownloadQuery type of thedownloads API defines a set of parameters that can be used to search the downloads manager for a specific set of downloads.

This type is used for example indownloads.search() anddownloads.erase(), as a query object to filter the set ofDownloadItems to return or erase.

Type

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

cookieStoreIdOptional

The cookie store ID of thecontextual identity in which the download took place. SeeWork with contextual identities for more information.

queryOptional

Anarray ofstrings. Include onlyDownloadItems whosefilename orurl contains all of the given strings. You can also include terms beginning with a dash (-) — these termsmust not be contained in the item'sfilename orurl for it to be included.

startedBeforeOptional

ADownloadTime. Include onlyDownloadItems that started before the given time.

startedAfterOptional

ADownloadTime. Include onlyDownloadItems that started after the given time.

endedBeforeOptional

ADownloadTime. Include onlyDownloadItems that ended before the given time.

endedAfterOptional

ADownloadTime. Include onlyDownloadItems that ended after the given time.

totalBytesGreaterOptional

Anumber representing a number of bytes. Include onlyDownloadItems whosetotalBytes is greater than the given number.

totalBytesLessOptional

Anumber representing a number of bytes. Include onlyDownloadItems whosetotalBytes is less than the given number.

filenameRegexOptional

Astring representing a regular expression. Include onlyDownloadItems whosefilename value matches the given regular expression.

urlRegexOptional

Astring representing a regular expression. Include onlyDownloadItems whoseurl value matches the given regular expression.

limitOptional

Aninteger representing a number of results. Include only the specified number ofDownloadItems.

orderByOptional

Anarray ofstrings representingDownloadItem properties the search results should be sorted by. For example, includingstartTime thentotalBytes in the array would sort theDownloadItems by their start time, then total bytes — in ascending order. To specify sorting by a property in descending order, prefix it with a hyphen, for example-startTime.

idOptional

Aninteger representing the ID of thedownloads.DownloadItem you want to query.

urlOptional

Astring representing the absolute URL that the download was initiated from, before any redirects.

filenameOptional

A string representing the absolute local path of the download file you want to query.

dangerOptional

A string representing adownloads.DangerType — include onlyDownloadItems with thisdanger value.

mimeOptional

Astring representing a MIME type. Include onlyDownloadItems with thismime value.

startTimeOptional

Astring representing anISO 8601 format time. Include onlyDownloadItems with thisstartTime value.

endTimeOptional

Astring representing anISO 8601 format time. Include only will limited toDownloadItems with thisendTime value.

stateOptional

Astring representing a downloaddownloads.State (in_progress,interrupted, orcomplete). Include onlyDownloadItems with thisstate value.

pausedOptional

Aboolean that indicates whether a download is paused — i.e., has stopped reading data from the host, but kept the connection open (true), or not (false). Include onlyDownloadItems with thispaused value.

errorOptional

A string representing adownloads.InterruptReason — a reason why a download was interrupted. Include onlyDownloadItems with thiserror value.

bytesReceivedOptional

Anumber representing the number of bytes received so far from the host, without considering file compression. Include onlyDownloadItems with thisbytesReceived value.

totalBytesOptional

Anumber representing the total number of bytes in the downloaded file, without considering file compression. Include onlyDownloadItems with thistotalBytes value.

fileSizeOptional

number. Number of bytes in the whole file post-decompression, or -1 if unknown. Anumber representing the total number of bytes in the file after decompression. Include onlyDownloadItems with thisfileSize value.

existsOptional

Aboolean indicating whether a downloaded file still exists (true) or not (false). Include onlyDownloadItems with thisexists value.

Browser compatibility

Note:This API is based on Chromium'schrome.downloads API.

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp