代码拉取完成,页面将自动刷新
Phonegap plugin to download a List of files or a single file to the Phone, check consistency and unzip if necessary (Android and ios)
yourAppDir$ phonegap plugin add https://github.com/fastrde/phonegap-downloader.git
###Initialize the downloader
downloader.init({folder: "yourPersistantAppFolder", unzip: true});
options:
DOWNLOADER_noWifiConnection
event [default: false]###Download single file
downloader.get("http://yourhost.de/some.zip");
###Download multiple files
downloader.getMultipleFiles([
{url:"http://yourhost.de/some1.zip"},
{url:"http://yourhost.de/some2.zip"},
{url:"http://yourhost.de/some3.zip"}
]);
###Abort download in progress You have to re-init downloader after aborting an transfer
downloader.abort();
###Events
document.addEventListener(eventName, function(event){
var data = event.data;
});
eventNames:
DOWNLOADER_initialized data:none
DOWNLOADER_gotFileSystem data:[cordova.fileSystem fileSystem]
DOWNLOADER_gotFolder data:[cordova.fileEntry folder]
DOWNLOADER_error data:[object error]
DOWNLOADER_noWifiConnection data:none
DOWNLOADER_downloadSuccess data:[cordova.fileEntry entry]
DOWNLOADER_downloadError data:[object error]
DOWNLOADER_downloadProgress data:[number percentage, string fileName]
DOWNLOADER_unzipSuccess data:[string fileName]
DOWNLOADER_unzipError data:[string fileName]
DOWNLOADER_unzipProgress data:[number percentage, string fileName]
DOWNLOADER_fileRemoved data:[cordova.fileEntry entry]
DOWNLOADER_fileRemoveError data:[cordova.fileEntry entry]
DOWNLOADER_getFileError data:[object error]
DOWNLOADER_fileCheckSuccess data:[string md5sum, string fileName]
DOWNLOADER_fileCheckFailed data:[string calculatedMd5sum, string md5, string fileName])
DOWNLOADER_fileCheckError data:[object error]
##Full Examples
downloader.init({folder: "testApp"});
downloader.get("http://yourhost.de/some.txt");
downloader.init({folder: "testApp", unzip: true});
downloader.get("http://yourhost.de/some.zip");
downloader.init({folder: "testApp", unzip: true, delete: false});
downloader.get("http://yourhost.de/some.zip");
downloader.init({folder: "testApp", unzip: true, check: true});
downloader.get("http://yourhost.de/some.zip", "3f4ea2219aa321ef5cd3143ea33076ab");
downloader.init({folder: "testApp", unzip: true, check: true});
downloader.get("http://yourhost.de/abort.zip");
downloader.abort();
downloader.init({folder: "testApp", unzip: true, check: true});
downloader.get("http://yourhost.de/another.zip");
downloader.init({folder: "testApp", unzip: true, check: true});
downloader.getMultipleFiles([
{url: "http://yourhost.de/some1.zip", md5:"1f4ea2219aa321ef5cd3143ea33076ac"},
{url: "http://yourhost.de/some2.zip", md5:"2f4ea2219aa321ef5cd3143ea33076ad"},
{url: "http://yourhost.de/some3.zip", md5:"3f4ea2219aa321ef5cd3143ea33076ae"}
]);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型