Download
The Download
object can be used to control / monitor the download of resources. You can create them using Server.downloadFile()
. The callback function you specify there will be executed with a reference of this type as this
object and you can use the following methods.
During development, you can use the ServerController
floating tile to inspect the downloads.
Class methods
abort
Aborts the download and deletes the file that was downloaded.
Download.abort()
getDownloadedTarget
Returns the target file if the download has succeeded.
Download.getDownloadedTarget()
getDownloadSize
Returns the download size in bytes.
Download.getDownloadSize()
getDownloadSpeed
Returns the current download speed in bytes / second.
Download.getDownloadSpeed()
getFullURL
Returns the full URL of the download.
Download.getFullURL()
getNumBytesDownloaded
Returns the number of bytes downloaded.
Download.getNumBytesDownloaded()
getProgress
Returns the progress ratio from 0 to 1.
Download.getProgress()
getStatusText
Returns a descriptive text of the current download state (eg. "Downloading" or "Paused").
Download.getStatusText()
isRunning
Checks if the download is currently active.
Download.isRunning()
resume
Resumes the download.
Download.resume()
stop
Stops the download. The target file will not be deleted and you can resume the download later.
Download.stop()