DownloadItem Type
⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ❌ | Exported ❌
Instance members
| Instance member |
Description
|
Full Usage:
this.canResume ()
Returns: bool
Modifiers: inline |
Whether the download can resume.
|
Full Usage:
this.cancel ()
Modifiers: inline |
Cancels the download operation. |
Full Usage:
this.getContentDisposition ()
Returns: string
Modifiers: inline |
The Content-Disposition field from the response header.
|
Full Usage:
this.getCurrentBytesPerSecond ()
Returns: int
Modifiers: inline |
The current download speed in bytes per second.
|
Full Usage:
this.getETag ()
Returns: string
Modifiers: inline |
ETag header value.
|
Full Usage:
this.getEndTime ()
Returns: double
Modifiers: inline |
Number of seconds since the UNIX epoch when the download ended.
|
Full Usage:
this.getFilename ()
Returns: string
Modifiers: inline |
The file name of the download item.> [!NOTE] The file name is not always the same as the actual one saved in local disk. If user changes the file name in a prompted download saving dialog, the actual name of saved file will be different.
|
Full Usage:
this.getLastModifiedTime ()
Returns: string
Modifiers: inline |
Last-Modified header value.
|
Full Usage:
this.getMimeType ()
Returns: string
Modifiers: inline |
The files mime type.
|
Full Usage:
this.getPercentComplete ()
Returns: int
Modifiers: inline |
The download completion in percent.
|
Full Usage:
this.getReceivedBytes ()
Returns: int
Modifiers: inline |
The received bytes of the download item.
|
Full Usage:
this.getSaveDialogOptions ()
Returns: obj
Modifiers: inline |
Returns the object previously set by downloadItem.setSaveDialogOptions(options).
|
Full Usage:
this.getSavePath ()
Returns: string
Modifiers: inline |
The save path of the download item. This will be either the path set via downloadItem.setSavePath(path) or the path selected from the shown save dialog.
|
Full Usage:
this.getStartTime ()
Returns: double
Modifiers: inline |
Number of seconds since the UNIX epoch when the download was started.
|
|
The current state. Can be progressing, completed, cancelled or interrupted.> [!NOTE] The following methods are useful specifically to resume a cancelled item when session is restarted.
|
Full Usage:
this.getTotalBytes ()
Returns: int
Modifiers: inline |
The total size in bytes of the download item.If the size is unknown, it returns 0.
|
Full Usage:
this.getURL ()
Returns: string
Modifiers: inline |
The origin URL where the item is downloaded from.
|
Full Usage:
this.getURLChain ()
Returns: string[]
Modifiers: inline |
The complete URL chain of the item including any redirects.
|
Full Usage:
this.hasUserGesture ()
Returns: bool
Modifiers: inline |
Whether the download has user gesture.
|
Full Usage:
this.isPaused ()
Returns: bool
Modifiers: inline |
Whether the download is paused.
|
|
Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via downloadItem.cancel()), and interrupted download that can't be resumed.The state can be one of following:* completed - The download completed successfully.* cancelled - The download has been cancelled.* interrupted - The download has interrupted and can not resume.
|
|
Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via downloadItem.cancel()), and interrupted download that can't be resumed.The state can be one of following:* completed - The download completed successfully.* cancelled - The download has been cancelled.* interrupted - The download has interrupted and can not resume. |
|
Emitted when the download has been updated and is not done.The state can be one of following:* progressing - The download is in-progress.* interrupted - The download has interrupted and can be resumed.
|
|
|
|
Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via downloadItem.cancel()), and interrupted download that can't be resumed.The state can be one of following:* completed - The download completed successfully.* cancelled - The download has been cancelled.* interrupted - The download has interrupted and can not resume.
|
|
Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via downloadItem.cancel()), and interrupted download that can't be resumed.The state can be one of following:* completed - The download completed successfully.* cancelled - The download has been cancelled.* interrupted - The download has interrupted and can not resume. |
|
Emitted when the download has been updated and is not done.The state can be one of following:* progressing - The download is in-progress.* interrupted - The download has interrupted and can be resumed.
|
|
|
|
Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via downloadItem.cancel()), and interrupted download that can't be resumed.The state can be one of following:* completed - The download completed successfully.* cancelled - The download has been cancelled.* interrupted - The download has interrupted and can not resume.
|
|
Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via downloadItem.cancel()), and interrupted download that can't be resumed.The state can be one of following:* completed - The download completed successfully.* cancelled - The download has been cancelled.* interrupted - The download has interrupted and can not resume. |
|
Emitted when the download has been updated and is not done.The state can be one of following:* progressing - The download is in-progress.* interrupted - The download has interrupted and can be resumed.
|
|
|
Full Usage:
this.pause ()
Modifiers: inline |
Pauses the download. |
Full Usage:
this.resume ()
Modifiers: inline |
Resumes the download that has been paused.> [!NOTE] To enable resumable downloads the server you are downloading from must support range requests and provide both Last-Modified and ETag header values. Otherwise resume() will dismiss previously received bytes and restart the download from the beginning. |
Full Usage:
this.savePath
|
A string property that determines the save file path of the download item.The property is only available in session's will-download callback function. If user doesn't set the save path via the property, Electron will use the original routine to determine the save path; this usually prompts a save dialog. |
Full Usage:
this.setSaveDialogOptions options
Parameters:
obj
Modifiers: inline |
This API allows the user to set custom options for the save dialog that opens for the download item by default. The API is only available in session's will-download callback function.
|
Full Usage:
this.setSavePath path
Parameters:
string
Modifiers: inline |
The API is only available in session's will-download callback function. If path doesn't exist, Electron will try to make the directory recursively. If user doesn't set the save path via the API, Electron will use the original routine to determine the save path; this usually prompts a save dialog.
|
fable-electron-docs-api