angularjs - ngCordova plugin zip deosn't works with Android -
i spent entire day trying resolve problem. file downloaded , stored in device memory, unziped.
// url of file download var url = "http://exapmle/someurl"; // file names var file = "aaa.zip"; $scope.contenutodownload = function () { // save location var targetpath = cordova.file.datadirectory + file; // use cordovafiletransfer store file in device storage $cordovafiletransfer.download(url + file, targetpath, {}, true).then(function (result) { console.log('file downloaded. ' + json.stringify(result)); $cordovazip .unzip( result.nativeurl, cordova.file.datadirectory ).then(function () { console.log('cordovazip success'); //delete zip file if(cordova.platformid == 'ios') { $cordovafile.removefile(cordova.file.tempdirectory,file); } else { $cordovafile.removefile(cordova.file.cachedirectory,file); } }, function () { console.log('cordovazip error'); }, function (progressevent) { console.log(progressevent); } ); }, function (error) { console.log('error cordovafiletransfer'); }, function (progress) { $timeout(function () { $scope.downloadprogress = ((progress.loaded / progress.total) * 100) + '%'; }); }); };
result 'cordovazip error', if try pass argument function (the error's one) no object returned.
looks paths incorrect
$cordovazip .unzip( result.nativeurl, cordova.file.datadirectory ).then(function () {
should or be
$cordovazip .unzip( targetpath, cordova.file.datadirectory ).then(function () {
not sure nativeurl gives console of these out see matches - thought nativeurl method nativeurl()
Comments
Post a Comment