-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #421
- Loading branch information
Showing
2 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {Plugin, Cordova} from './plugin'; | ||
|
||
/** | ||
* @name Zip | ||
* @description | ||
* A Cordova plugin to unzip files in Android and iOS. | ||
* | ||
* @usage | ||
* ``` | ||
* import {Zip} from 'ionic-native'; | ||
* | ||
* Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%')) | ||
* .then((result) => { | ||
* if(result === 0) console.log('SUCCESS'); | ||
* if(result === -1) console.log('FAILED'); | ||
* }); | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
plugin: 'cordova-plugin-zip', | ||
pluginRef: 'zip', | ||
repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip', | ||
}) | ||
export class Zip { | ||
/** | ||
* Extracts files from a ZIP archive | ||
* @param sourceZip {string} Source ZIP file | ||
* @param destUrl {string} Destination folder | ||
* @param onProgress {Function} optional callback to be called on progress update | ||
* @return {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error | ||
*/ | ||
@Cordova({ | ||
successIndex: 2, | ||
errorIndex: 4 | ||
}) | ||
static unzip(sourceZip: string, destUrl: string, onProgress: Function): Promise<number> {return; } | ||
|
||
} |