NKFileDownloader
Overview
This class is used to download files from internet to documents folder (later those files can be opened with NKFile).
openURL(url)
Initializes current downloader with url
start(fileName)
Starts asynchronous download process.
filename - name of the output file to be created in documents folder
stop()
Stops download
getProgress()
Returns percentage of downloaded data or -1 if error occured
Example:
var download = new NKFileDownloader();
download.openURL("http://www.nimblekit.com/nimblekit.dmg");
download.start("nimblekit.dmg");
setTimeout(updateProgress, 1000);
function updateProgress()
{
var progress = download.getProgress();
if (progress == -1)
{
NKLog("Could not download file");
}
else
{
NKLog("downloaded: "+progress);
if (download.getProgress()<100)
setTimeout(updateProgress, 1000);
}
}


