jjdltc / jjdltc-cordova-plugin-zip

A plugin to zip and unzip files or directories
MIT License
23 stars 25 forks source link

Additional API support #17

Open avargaskun opened 2 years ago

avargaskun commented 2 years ago

Adding the following functionality to the plugin:

This makes breaking changes to the API (see further below for examples):

Examples:

// Creating ZIP from single folder
window.JJzip.zipFolder(
    cordova.file.dataDirectory + 'inputFolder',
    cordova.file.dataDirectory + 'out.zip',
    function() { console.log('success'); },
    function(err) { console.log('error: ' + err) });
// Creating ZIP with multiple files
const files = [
    cordova.file.dataDirectory + 'file1.txt',
    cordova.file.dataDirectory + 'file2.txt',
];
window.JJzip.zipFiles(
    files,
    cordova.file.dataDirectory + 'out.zip',
    function() { console.log('success'); },
    function(err) { console.log('error: ' + err) });
// Unzipping into target folder
window.JJzip.unzip(
    cordova.file.dataDirectory + 'input.zip',
    cordova.file.dataDirectory + 'extracted',
    function() { console.log('success'); },
    function(err) { console.log('error: ' + err) });
avargaskun commented 2 years ago

Hello! Thank you for this writing this helpful plug-in. Here's a few improvements a while back in case you're interested in pulling them into the main branch. This includes a breaking change to the plug-in API so I bumped the version number (2.0.0 -> 3.0.0)