UNPKG

941 BTypeScriptView Raw
1/**
2 * @name Zip
3 * @description
4 * A Cordova plugin to unzip files in Android and iOS.
5 *
6 * @usage
7 * ```
8 * import {Zip} from 'ionic-native';
9 *
10 * Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
11 * .then((result) => {
12 * if(result === 0) console.log('SUCCESS');
13 * if(result === -1) console.log('FAILED');
14 * });
15 *
16 * ```
17 */
18export declare class Zip {
19 /**
20 * Extracts files from a ZIP archive
21 * @param sourceZip {string} Source ZIP file
22 * @param destUrl {string} Destination folder
23 * @param onProgress {Function} optional callback to be called on progress update
24 * @returns {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
25 */
26 static unzip(sourceZip: string, destUrl: string, onProgress?: Function): Promise<number>;
27}