UNPKG

2.05 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var plugin_1 = require('./plugin');
9/**
10 * @name Zip
11 * @description
12 * A Cordova plugin to unzip files in Android and iOS.
13 *
14 * @usage
15 * ```
16 * import {Zip} from 'ionic-native';
17 *
18 * Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
19 * .then((result) => {
20 * if(result === 0) console.log('SUCCESS');
21 * if(result === -1) console.log('FAILED');
22 * });
23 *
24 * ```
25 */
26var Zip = (function () {
27 function Zip() {
28 }
29 /**
30 * Extracts files from a ZIP archive
31 * @param sourceZip {string} Source ZIP file
32 * @param destUrl {string} Destination folder
33 * @param onProgress {Function} optional callback to be called on progress update
34 * @returns {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
35 */
36 Zip.unzip = function (sourceZip, destUrl, onProgress) { return; };
37 __decorate([
38 plugin_1.Cordova({
39 successIndex: 2,
40 errorIndex: 4
41 })
42 ], Zip, "unzip", null);
43 Zip = __decorate([
44 plugin_1.Plugin({
45 pluginName: 'Zip',
46 plugin: 'cordova-plugin-zip',
47 pluginRef: 'zip',
48 repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip',
49 })
50 ], Zip);
51 return Zip;
52}());
53exports.Zip = Zip;
54//# sourceMappingURL=zip.js.map
\No newline at end of file