Open sadikyalcin opened 6 years ago
I'm not clear on how this plugin supposed to work but it clearly fails to extract the zip. Here is my code;
download: function(){ app.downloadZip('1535', function _onProgress(fileDownloader) { console.log('Progress: ', fileDownloader); /* var downloadProgress = parseFloat(fileDownloader.downloadProgress); downloadProgress = Math.round(downloadProgress * 100); console.log('Progress: ', downloadProgress); */ }, function _onSuccess(entry) { console.log('Entry: ', entry); presenter.fileSystem.createDirectory(config.appDirName + '/1535', function __onSuccess() { console.log('Done!'); app.extract(entry); }, function __onError(error) { onError(error); } ); }, function _onAbort() { }, function _onError(error) { console.log('error: ', error); } ); }, downloadZip: function(zip, onProgress, onSuccess, onAbort, onError) { var url = 'http://companyapp.co.uk/1535.zip'; app.fileDownloader.remoteURL = url; app.fileDownloader.localFilePath = config.appDirName + '/' + '1535.zip'; app.fileDownloader.bytesToDownload = '2435379'; app.fileDownloader.download(options = { trustAllHosts: true}, function _onProgress() { onProgress(presenter.fileDownloader); }, function _onSuccess(zip) { onSuccess(zip); }, function _onAbort() { onAbort(); }, function _onError(error) { onError(error); } ); } extract: function(entry){ var zip = entry.nativeURL; var extracted = entry.name.split('.'); extracted = extracted['0']; var fs = presenter.fileSystem.getFS(); fs.root.getDirectory(config.appDirName + '/' + extracted, { create: false }, function(presFolder){ console.log(presFolder); Zeep.unzip({ from : zip, to : presFolder.nativeURL }, function(e) { console.log('success: ', e); // print out: success: OK }, function(e) { console.log('error: ', e); }); }, function(e){ console.log(e) } ); },
I'm not clear on how this plugin supposed to work but it clearly fails to extract the zip. Here is my code;