capacitor-community / proposals

Plugin and platform requests ✋
74 stars 2 forks source link

Zip #145

Open elvisgraho opened 2 years ago

elvisgraho commented 2 years ago

Plugin Request

Since Capacitor team stated that in the future there should be no cordova plugins, I would like to see zip plugin that allows me to unzip files

Name: zip Package: @capacitor-community/zip

Platform(s)

iOS / Android

Existing Solutions

https://github.com/MobileChromeApps/cordova-plugin-zip + @ionic-native/zip

Description

I use zip.unzip method to unzip .zip files on the device.

mattbatman commented 1 year ago

I couldn't get https://github.com/MobileChromeApps/cordova-plugin-zip to work for my purposes. I fed it a zipped directory, and it would only unzip the first file but behave as if it were successful. It doesn't seem like the project has been maintained since 2016.

I've searched through and tried some of the existing capacitor zip packages on npm, but it seems like there's nothing that's actively maintained and that would work beyond Capacitor version 3. As far as I can tell, to unzip a zipped folder in a Capacitor application, your options are to:

  1. create your own plug-in
  2. use JSZip to read the contents of each file into memory and then write each file to the filesystem again
  3. downgrade your project to Capacitor version 2 or 3
jmdjr commented 1 year ago

I am looking to get unzipping working in my capacitor app, but am running into an error when it runs on the device... NativescriptCapacitor/NativeScriptCapPlugin.swift:27: Fatal error: Unexpectedly found nil while unwrapping an Optional value.

seletz commented 6 months ago

For my app I use @zip.js/zip.js and the @capacitor/filesystem plugin. This works -- the use case I have is to download zip from S3 to local FS to provide offline use capability.

I have this working in iOS and the browser. I think android works, too.

robingenz commented 4 months ago

🎉 I've just published a Capacitor Zip plugin: https://capawesome.io/plugins/zip/ Let me know if you are missing any features!