@capawesome-team/capacitor-zip¶
Capacitor plugin to zip and unzip files.
Features¶
- 🖥️ Cross-platform: Supports Android and iOS.
- 📁 File Compression: Zip and unzip single or multiple files.
- 🔑 Encryption: Encrypt and decrypt files.
- 🔁 Up-to-date: Always supports the latest Capacitor version.
- ⭐️ Support: First-class support from the Capawesome Team.
Installation¶
This plugin is only available to Capawesome Insiders. First, make sure you have the Capawesome npm registry set up. You can do this by running the following commands:
npm config set @capawesome-team:registry https://npm.registry.capawesome.io
npm config set //npm.registry.capawesome.io/:_authToken <YOUR_LICENSE_KEY>
Attention: Replace <YOUR_LICENSE_KEY>
with the license key you received from Polar. If you don't have a license key yet, you can get one by becoming a Capawesome Insider.
Next, install the package:
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.