1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26// install : cordova plugin add https://github.com/MobileChromeApps/zip.git
// link : https://github.com/MobileChromeApps/zip
angular.module('ngCordova.plugins.zip', [])
.factory('$cordovaZip', ['$q', '$window', function ($q, $window) {
return {
unzip: function (source, destination) {
var q = $q.defer();
$window.zip.unzip(source, destination, function (isError) {
if (isError === 0) {
q.resolve();
} else {
q.reject();
}
}, function (progressEvent) {
q.notify(progressEvent);
});
return q.promise;
}
};
}]);