@capawesome-team/capacitor-zip¶
Capacitor plugin to zip and unzip files.
Features¶
- 🔋 Supports Android and iOS
- 📁 Zip and unzip single or multiple files
- 🔑 Encrypt and decrypt files
Sponsorware¶
This project is available as Sponsorware.
Sponsorware is a release strategy for open-source software that enables developers to be compensated for their open-source work with fewer downsides than traditional open-source funding models. (Source)
This means...
- The source code will be published as soon as the funding goal is reached.
- Any sponsor with a sponsorware tier gets immediate access to our sponsors-only repository and can start using the project right away.
Terms¶
This project is licensed under the terms of the MIT license.
However, we kindly ask you to respect our fair use policy:
- Please don't distribute the source code of the sponsors-only repository. You may freely use it for public, private or commercial projects, privately fork or mirror it, but please don't make the source code public, as it would counteract the sponsorware strategy.
- If you cancel your subscription, you're automatically removed as a collaborator and will miss out on all future updates. However, you may use the latest version that's available to you as long as you like.
Installation¶
See Getting started with Insiders and follow the instructions to install the plugin.
Android Variables¶
This plugin will use the following project variables (defined in your app’s variables.gradle
file):
$zip4jVersion
version ofnet.lingala.zip4j:zip4j
(default:2.11.5
)
Configuration¶
No configuration required for this plugin.
Demo¶
A working example can be found here: robingenz/capacitor-plugin-demo
Usage¶
import { Zip } from '@capawesome-team/capacitor-zip';
const unzip = async () => {
await Zip.unzip({
source: 'file:///data/user/0/dev.robingenz.capacitor.plugindemo/cache/1714900095398.zip',
destination: 'file:///data/user/0/dev.robingenz.capacitor.plugindemo/cache/1714900095398',
password: 'secret',
});
};
const zip = async () => {
await Zip.zip({
source: 'file:///data/user/0/dev.robingenz.capacitor.plugindemo/cache/1714900095398',
destination: 'file:///data/user/0/dev.robingenz.capacitor.plugindemo/cache/1714900095398.zip',
password: 'secret',
});
};
API¶
unzip(...)¶
Unzip a file.
Only available on Android and iOS.
Param | Type |
---|---|
options |
UnzipOptions |
Since: 6.0.0
zip(...)¶
Zip a file or directory.
Only available on Android and iOS.
Param | Type |
---|---|
options |
ZipOptions |
Since: 6.0.0
Interfaces¶
UnzipOptions¶
Prop | Type | Description | Since |
---|---|---|---|
destination |
string |
The destination directory. | 6.0.0 |
password |
string |
The password to decrypt the zip file. | 6.1.0 |
source |
string |
The source file to unzip. | 6.0.0 |
ZipOptions¶
Prop | Type | Description | Since |
---|---|---|---|
destination |
string |
The destination file. | 6.0.0 |
password |
string |
The password to encrypt the zip file. | 6.1.0 |
source |
string |
The source file or directory to zip. | 6.0.0 |
Changelog¶
See CHANGELOG.md.
License¶
See LICENSE.