Download

class Download(pointer: <Error class: unknown class><<Error class: unknown class>>)

Object used to communicate with the application when downloading.

#WebKitDownload carries information about a download request and response, including a #WebKitURIRequest and a #WebKitURIResponse objects. The application may use this object to control the download process, or to simply figure out what is to be downloaded, and handle the download process itself.

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Whether or not the download is allowed to overwrite an existing file on disk. If this property is false and the destination already exists, the download will fail.

Link copied to clipboard

The local path to where the download will be saved.

Link copied to clipboard
val estimatedProgress: <Error class: unknown class>

An estimate of the percent completion for the download operation. This value will range from 0.0 to 1.0. The value is an estimate based on the total number of bytes expected to be received for a download. If you need a more accurate progress information you can connect to #WebKitDownload::received-data signal to track the progress.

Link copied to clipboard

The #WebKitURIResponse associated with this download.

Link copied to clipboard
val webkitDownloadPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
fun cancel()

Cancels the download.

Link copied to clipboard
fun connectCreatedDestination(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (destination: String) -> Unit): <Error class: unknown class>

This signal is emitted after #WebKitDownload::decide-destination and before #WebKitDownload::received-data to notify that destination file has been created successfully at @destination.

Link copied to clipboard
fun connectDecideDestination(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (suggestedFilename: String) -> Boolean): <Error class: unknown class>

This signal is emitted after response is received to decide a destination for the download using webkit_download_set_destination(). If this signal is not handled, the file will be downloaded to %G_USER_DIRECTORY_DOWNLOAD directory using @suggested_filename.

Link copied to clipboard
fun connectFailed(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Unit): <Error class: unknown class>

This signal is emitted when an error occurs during the download operation. The given @error, of the domain %WEBKIT_DOWNLOAD_ERROR, contains further details of the failure. If the download is cancelled with webkit_download_cancel(), this signal is emitted with error %WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER. The download operation finishes after an error and #WebKitDownload::finished signal is emitted after this one.

Link copied to clipboard
fun connectFinished(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

This signal is emitted when download finishes successfully or due to an error. In case of errors #WebKitDownload::failed signal is emitted before this one.

Link copied to clipboard
fun connectReceivedData(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Unit): <Error class: unknown class>

This signal is emitted after response is received, every time new data has been written to the destination. It's useful to know the progress of the download operation.

Link copied to clipboard
fun getElapsedTime(): <Error class: unknown class>

Gets the elapsed time in seconds, including any fractional part.

Link copied to clipboard
fun getReceivedDataLength(): <Error class: unknown class>

Gets the length of the data already downloaded for @download.

Link copied to clipboard

Retrieves the #WebKitURIRequest object that backs the download process.

Link copied to clipboard

Get the #WebKitWebView that initiated the download.

Link copied to clipboard
fun setDestination(destination: String)

Sets the destination to which the downloaded file will be written.