Back

CreateDownloader

Downloader creates a Downloader object for downloading files directly from the internet to the device's local storage.

app.CreateDownloader( options ) -> app object - Downloader

Example - Example



function OnStart()
{
    var srcFileUrl="http://sgarman.net/downloadable.txt";
    var targetDir="/sdcard";

    dload = app.CreateDownloader();
    dload.SetOnComplete( dload_OnComplete );
    dload.Download( srcFileUrl, targetDir );
}

function dload_OnComplete()
{
    app.ShowPopup("Download complete");
}
    Copy     Copy All       Run      

The following methods are avaiable on the Downloader object:

  Destroy()
  GetProgress() -> unknown
  GetSize() -> unknown
  GetType() -> string - "Downloader"
  IsComplete() -> boolean
  Release()
  id -> string - "#id"

unknown
destroys object
string - url path
string - path to file or folder ( "/absolute/..." or "relative/..." )
string
Download file
get current download progress
get target download size
return wether download compleated or not
?
function()
? called when download cancelled
function()
called when download finished
function( path )
?
function( error )
called when error occurred while downloading
object id