Visit Mozilla.org

nsIDownload

From MDC

This article covers features introduced in Firefox 3

The nsIDownload interface describes a download object. Download objects are used by the Download Manager (see nsIDownloadManager to manage files that are queued to download, being downloaded, and finished being downloaded.)

Note: Once the download is completed, the Download Manager stops updating the nsIDownload object. Completed states are nsIDownloadManager::DOWNLOAD_FINISHED, nsIDownloadManager::DOWNLOAD_FAILED, and nsIDownloadManager::DOWNLOAD_CANCELED.

Contents

nsIDownload is defined in toolkit/components/downloads/public/nsIDownload.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.9).

Inherits from: nsITransfer

[edit] Attributes

Attribute Type Description
targetFile nsILocalFile Indicates the location at which the downloaded file will be (or is, if the download is complete) stored. Read only.
percentComplete PRint32 The percentage of the file transfer that has been completed, or -1 if the file's size is unknown. Read only.
amountTransferred PRUint64 The number of bytes downloaded so far. Read only.
size PRUint64 The total size of the file in bytes, or LL_MAXUINT if the file's size is unknown. Read only.
source nsIURI The source URI of the download. Read only.
cancelable nsICancelable An object that can be used to cancel the download. Once the download is complete, this value is set to null. Read only.
displayName AString A user-readable description of the transfer. Read only.
startTime long long The time at which the transfer was started. Read only.
speed double The download's transfer speed in bytes per second. Read only.
MIMEInfo nsIMIMEInfo This optional attribute provides the target's relevant MIME information, including its MIME type, helper application, and whether or not the helper should be executed automatically once the download is complete.
id unsigned long The ID by which the download is identified uniquely in the database.
state short The download's current state. See the nsIDownloadManager constants list.
referrer nsIURI The referrer URI of the download. This is only valid for HTTP downloads, and can be null.
resumable boolean Indicates if the download can be resumed after being paused or not. This is only the case if the download is over HTTP/1.1 or FTP and if the server supports it.

[edit] See also

nsIDownloadManager, nsIDownloadProgressListener, nsIXPInstallManagerUI