phonegap-downloader
Phonegap plugin to download a List of files or a single file to the Phone, check consistency and unzip if necessary (Android and ios)
Changes 0.2.0 -> 0.2.1
- Added downloader.abort() function to abort downloads in progress.
Changes 0.1.5 -> 0.2.0
- move to new cordova plugin registry
Changes 0.1.4 -> 0.1.5
- Fix for issue #2 new initialization after download-error works properly now.
Changes 0.1.3 -> 0.1.4
- fixed an issue with older javascript versions and reserved words.
Changes 0.1.2 -> 0.1.3
- Unzipping is now queue based like the download porgress.
Changes 0.1.1 -> 0.1.2
- noMedia flag in init options to prevent gallery from scanning download folder
install
yourAppDir$ phonegap plugin add https://github.com/fastrde/phonegap-downloader.git
usage
Initialize the downloader
downloader;
options:
- folder: folder to store downloads in [required]
- fileSystem: fileSystem to store downloads in (use cordova.file.* to be platform independent)
- unzip: true -> unzip after download is enabled [default: false]
- check: true -> md5sum of file is checked after download [default: false]
- delete: true -> delete after unpack a zipfile [default: true]
- noMedia: true -> prevent gallery from scan files on android [default: true]
- wifiOnly: true -> only Download when connected to Wifi, else fires
DOWNLOADER_noWifiConnection
event [default: false]
Download single file
downloader;
Download multiple files
downloader;
Abort download in progress
You have to re-init downloader after aborting an transfer
downloader;
Events
document; eventNames:DOWNLOADER_initialized data:noneDOWNLOADER_gotFileSystem data:cordovafileSystem fileSystemDOWNLOADER_gotFolder data:cordovafileEntry folderDOWNLOADER_error data:object errorDOWNLOADER_noWifiConnection data:noneDOWNLOADER_downloadSuccess data:cordovafileEntry entryDOWNLOADER_downloadError data:object errorDOWNLOADER_downloadProgress data:number percentage string fileNameDOWNLOADER_unzipSuccess data:string fileNameDOWNLOADER_unzipError data:string fileNameDOWNLOADER_unzipProgress data:number percentage string fileNameDOWNLOADER_fileRemoved data:cordovafileEntry entryDOWNLOADER_fileRemoveError data:cordovafileEntry entryDOWNLOADER_getFileError data:object error DOWNLOADER_fileCheckSuccess data:string md5sum string fileNameDOWNLOADER_fileCheckFailed data:string calculatedMd5sum string md5 string fileName)DOWNLOADER_fileCheckError data:object error
Full Examples
Download file some.txt to folder testApp
downloader;downloader;
Download file some.zip to testApp, extract it and delete it afterwards
downloader;downloader;
Download file some.zip to testApp, extract it and don't delete it afterwards
downloader;downloader;
Download file some.zip to testApp, check if md5sum matches given string and extract it and delete it afterwards
downloader;downloader;
Download file abort.zip and abort download, the download another.zip
downloader;downloader;downloader;downloader;downloader;
Download multiple zip-files to testApp, check if md5sum matches given string and extract it and delete it afterwards
downloader;downloader;