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?

Hi can you please guide how to import the zip method from ā€œcordova-plugin-zipā€ .
Documentation does not specify :

how my react code will import the zip method ? or it is available globally ?
Please help this is very time consuming for me.