i am use the ionic2 ZIP from ionic-native. unfortunately the unzipping failed. Cant understand what’s wrong:
openQStorage(){
document.addEventListener('deviceready', () => {
console.log(cordova.file.externalDataDirectory);
let zipSource: string = cordova.file.applicationDirectory + 'www/assets/storage/opencms.zip';
let dataDirectory: string = cordova.file.externalDataDirectory;
console.log('AppDir: ', cordova.file.applicationDirectory);
console.log('Zip: ', zipSource);
console.log('Dest: ', dataDirectory);
this.UrlExists(zipSource);
File.resolveLocalFilesystemUrl(zipSource)
.then((zipEntry: any) => {
console.log(zipEntry);
File.resolveLocalFilesystemUrl(dataDirectory)
.then((dirEntry: any) => {
console.log(dirEntry);
zipEntry.copyTo(dirEntry, 'opencms.zip', (newZipEntry) => {
console.log(newZipEntry);
console.log(newZipEntry.nativeURL);
Zip.unzip(newZipEntry.nativeURL, dirEntry, (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
.then((result) => {
if(result === 0) console.log('unzip success');
if(result === -1) console.log('unzip failed');
})
});
})
});
}, false)
}