README
cordova-plugin-files-downloader
An Android Cordova plugin that allows you to download files using download manager. You can start more than one download and each of them will be presented on the notification bar. You can handle the progress and cancel each download. This plugis handles also download cancellation taken on the notification bar. If you work with ZIP archive you can extract it with this plugin also.
Installation
cordova plugin add cordova-plugin-files-downloader
Supported Platforms
- Android
Usage
download
FilesDownloader.download('https://cordova.apache.org/static/img/cordova_256.png', file, {
title: 'Downloading...',
extract: false
}, (result) => {
// progress
}, (err) => {
// err
alert(JSON.stringify(err));
});
Parameters:
remoteUrl: URL of the file to download
destinationFile:
FileEntryobjectoptions: Optional parameters (Object). Valid keys:
- title: The download title in the notification bar
- extract: If true, downloaded
ZIParchive will be extracted when completed. You receivefinishedstatus when extraction will be finished.
successCallback: A callback with download status and progress. (Function)
errorCallback: A callback that executes if an error occurs. (Function)
cancel
FilesDownloader.cancel('https://cordova.apache.org/static/img/cordova_256.png', (result) => {
// ok
}, (err) => {
// err
alert(JSON.stringify(err));
});
Parameters:
remoteUrl: URL of the file to cancel active downalod
successCallback: A callback with cancellation status. (Function)
errorCallback: A callback that executes if an error occurs. (Function)