DownloadItem

external class DownloadItem : EventEmitter(source)

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

A string property that determines the save file path of the download item.

Functions

Link copied to clipboard
fun addListener(type: EventType, listener: EventListener)
Link copied to clipboard
fun cancel()

Cancels the download operation.

Link copied to clipboard

Whether the download can resume.

Link copied to clipboard
fun emit(type: EventType, vararg args: Any?): Boolean
Link copied to clipboard
Link copied to clipboard

The Content-Disposition field from the response header.

Link copied to clipboard

ETag header value.

Link copied to clipboard

The file name of the download item.

Link copied to clipboard

Last-Modified header value.

Link copied to clipboard
Link copied to clipboard

The files mime type.

Link copied to clipboard

The received bytes of the download item.

Link copied to clipboard

Returns the object previously set by downloadItem.setSaveDialogOptions(options).

Link copied to clipboard

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.

Link copied to clipboard

Number of seconds since the UNIX epoch when the download was started.

Link copied to clipboard

The current state. Can be progressing, completed, cancelled or interrupted.

Link copied to clipboard

The total size in bytes of the download item.

Link copied to clipboard
fun getURL(): String

The origin URL where the item is downloaded from.

Link copied to clipboard

The complete URL chain of the item including any redirects.

Link copied to clipboard

Whether the download has user gesture.

Link copied to clipboard

Whether the download is paused.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun off(type: EventType, listener: EventListener)
Link copied to clipboard
fun on(type: EventType, listener: EventListener)
Link copied to clipboard
fun once(type: EventType, listener: EventListener)
Link copied to clipboard
fun pause()

Pauses the download.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun removeListener(type: EventType, listener: EventListener)
Link copied to clipboard
fun resume()

Resumes the download that has been paused.

Link copied to clipboard
Link copied to clipboard

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.

Link copied to clipboard
fun setSavePath(path: String)

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.