Ionic: Native Unzip

Are there any plans to roll out a zip/unzip component or native zip/unzip wrapper for Ionic 2?

Been struggling majorly to get JSZip, as well as cordova-plugin-zip (https://github.com/MobileChromeApps/cordova-plugin-zip) to work with unzipping a file.

Downloading the zip is no problem- but extracting it seems to be quite the challenge!

1 Like

Nvm, fixed my issue (i’ll post code tomorrow to help out fellow code buddies), but a native wrapper (or better yet, component) would be nice!

HI rw152,

Did you able to make Zip native work? Can you please share how it is done? I’m having error while importing the Zip “import { Zip } from ‘ionic-native’;”

Thank you

2 Likes

Hi,

I have a same problem. Do you have a solution ?

Thank you.

Hey guys, so sorry! Are you still stuck? I believe I used this and installed the associated plugin: https://github.com/MobileChromeApps/cordova-plugin-zip

  1. First i installed the cordova plugin
$ ionic plugin add cordova-plugin-zip
  1. Then I think I had to declare it like this since there was something funky going on with the import… you declare this variable right beneath/after your “import” statements
//cordova zip integration... declared at the top of the .ts file you're planning to use it in
declare var zip: any;
  1. Create a public variable inside your class
 public zip:any;
  1. Then use it as the docs explain
 zip.unzip(res.nativeURL, destPath, doneCallback);

Hope that helps… sorry it’s not very thorough!

1 Like

Also make sure your ionic-native is in latest version that include zip. If not you can pull it in the repo https://github.com/driftyco/ionic-native

1 Like

Have you able to solve this?