The HttpDownload object provides a high-level interface for downloading files from HTTP servers. Once started via start() or the running property the download is performed asynchronously in the background. The progress can be monitored through the bytesReceived property. When finished the finished() signal is emitted and the running property changes to false.

› Inherits:Object



This property holds the number of bytes already downloaded.

› Type:SignedBigInteger
› Signal:bytesReceivedChanged()
› Attributes:Readonly


This property holds the total number of bytes to download.

› Type:SignedBigInteger
› Signal:bytesTotalChanged()
› Attributes:Readonly


This property holds the most recently occurred error or HttpDownload.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.

› Type:Error
› Signal:errorChanged()
› Attributes:Readonly


This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.

› Type:String
› Signal:errorStringChanged()
› Attributes:Readonly


This property holds a File object representing the file which the downloaded data is written to.

› Type:File
› Signal:outputFileChanged()
› Attributes:Writable


This property holds the request used for initiating the download. It can be used for customizing e.g. the used HTTP headers.

› Type:HttpRequest
› Signal:requestChanged()
› Attributes:Writable


This property holds whether the download is currently running. Changing this property is equivalent to calling start() and stop(). After a download has been finished this property changes to false automatically.

› Type:Boolean
› Default:true
› Signal:runningChanged()
› Attributes:Writable


This property holds the URL of the file to download. It wraps the HttpRequest.url property and is provided for convenience only.

› Type:String
› Signal:urlChanged()
› Attributes:Writable



This method starts the download if it’s not running already. It returns true if the download could be started succesfully. Otherwise an error is indicated through the error property. This method does not block. Instead the finished() signal is emitted when the download has been finished.

› Returns:Boolean


This method stops the download, i.e. aborts a running download. If it is not running, this method has no effect and does not raise an error.



This signal is emitted whenever an error has occurred, regardless of whether the error property has changed or not. In contrast to the change notification signal of the error property this signal is also emitted several times if a certain error occurs several times in succession.


This signal is emitted when a download has been finished. It’s also emitted if an error occurred while downloading.



This enumeration describes all errors which can occur in HttpDownload objects. The most recently occurred error is stored in the error property.

Name Value Description
HttpDownload.NoError 0 No error occurred or was detected.
HttpDownload.AlreadyRunning 1 The download is already running and can’t be started.
HttpDownload.InvalidRequest 2 The request property is empty or invalid.
HttpDownload.InvalidOutputFile 3 The output file property is empty or invalid.
HttpDownload.OutputFileNotWritable 4 The output file can’t be opened for writing.


import InCore.Foundation 2.5
import InCore.Http 2.5

Application {

    HttpDownload {
        url: ""
        outputFile: File { fileName: "mini.iso"; storage: InMemoryStorage { } }
            console.log("Download progress:",
                        (bytesTotal > 0 ? Math.round(bytesReceived * 100 / bytesTotal) : 0) + "%");
        onFinished: console.log(bytesTotal, "bytes have been downloaded successfully to",
                       + "/" + outputFile.fileName)
        onCompleted: start();