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. Edit on GitHub
Download.abort()
getDownloadedTarget
Returns the target file if the download has succeeded. Edit on GitHub
Download.getDownloadedTarget()
getDownloadSize
Returns the download size in bytes. Edit on GitHub
Download.getDownloadSize()
getDownloadSpeed
Returns the current download speed in bytes / second. Edit on GitHub
Download.getDownloadSpeed()
getFullURL
Returns the full URL of the download. Edit on GitHub
Download.getFullURL()
getNumBytesDownloaded
Returns the number of bytes downloaded. Edit on GitHub
Download.getNumBytesDownloaded()
getProgress
Returns the progress ratio from 0 to 1. Edit on GitHub
Download.getProgress()
getStatusText
Returns a descriptive text of the current download state (eg. "Downloading" or "Paused"). Edit on GitHub
Download.getStatusText()
isRunning
Checks if the download is currently active. Edit on GitHub
Download.isRunning()
resume
Resumes the download. Edit on GitHub
Download.resume()
stop
Stops the download. The target file will not be deleted and you can resume the download later. Edit on GitHub
Download.stop()