Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

downloads.DownloadItem

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

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.

ドキュメントのタグと貢献者

 このページの貢献者: wbamberg, chrisdavidmills
 最終更新者: wbamberg,