I have an application with cordova
for android
in which I want to unzip a file .ZIP
To do this, use the following code but the plugin cordova-plugin-zip
of cordova, but when executing, send me an error and the text: "Oops, cannot decompress files"
myApp.onPageInit('actualizarApp', function (page) {
myApp.params.swipePanel = false;
actualizar();
});
var phatZIP='127.0.0.1/archivo.zip';
var destino ='/storage/emulated/0/';
function actualizar(){
$$('#btn-actualizar').on('click',function(){
//alerta('Hola');
processZip(phatZIP,destino);
});
}
function processZip(phatZIP, destino){
// Handle the progress event
var progressHandler = function(progressEvent){
var percent = Math.round((progressEvent.loaded / progressEvent.total) * 100);
// Display progress in the console : 8% ...
console.log(percent + "%");
};
// Proceed to unzip the file
window.zip.unzip(phatZIP, destino, (status) => {
if(status == 0){
console.log("Files succesfully decompressed");
}
if(status == -1){
console.error("Oops, cannot decompress files");
}
}, progressHandler);
}
<div class="navbar">
<div class="navbar-inner">
<div class="left"><a href="#" class="back link"> <i class="icon icon-back"></i><span>Atrás</span></a></div><br>
<div class="center sliding" style="font-size: 13px;"><div class="item-media"><i class="f7-icons">layers</i></div>Actualizar Aplicación</div>
</div>
</div>
<div class="pages">
<div data-page="actualizarApp" class="page">
<div class="page-content">
<div class="content-block-title" style="margin-top:12px;"></div>
<div class="list-block">
<div class="content-block-title" style="text-align:center">Información de la Aplicación</div>
<div class="content-block-inner">
<p><a href="#" id="btn-actualizar" class="button button-big btn-login">Actualizar</a></p>
</div>
</div>
</div>
</div>
</div>