cordova-unzip
v0.1.1
Published
Modern unzip plugin for Cordova on Android and iOS.
Maintainers
Readme
cordova-unzip
Modern unzip plugin for Cordova on Android and iOS.
Why this exists
Older Cordova zip plugins were built around outdated Android storage assumptions and older iOS plugin patterns. This package uses:
- Java on Android with
content://input support - Swift on iOS with
ZIPFoundation - Zip Slip protection on both platforms
- One npm package for Cordova consumers
Install
Cordova
cordova plugin add cordova-unzipAPI
Cordova
cordova.plugins.unzip.unzip(
{
source: '/absolute/path/to/archive.zip',
destination: '/absolute/path/to/output',
overwrite: true
},
function (result) {
console.log(result);
},
function (error) {
console.error(error);
}
);Options
source: absolute file path,file://URL, or on Android acontent://URIdestination: absolute directory path orfile://URLoverwrite: defaults totrue
Result
{
"destination": "/absolute/path/to/output",
"extractedCount": 3,
"entries": [
"/absolute/path/to/output/a.txt",
"/absolute/path/to/output/folder",
"/absolute/path/to/output/folder/b.txt"
]
}Android notes
content://archive sources are supported.- Destination output must be a writable filesystem directory path.
iOS notes
- The plugin currently expects local file-based archives and destinations.
content://is Android-only.
Publish
Before publishing, update the repository URLs and author values in:
package.json
Then publish with:
npm publish