jjdltc / jjdltc-cordova-plugin-zip

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

Zip / UnZip plugin

Cordova plugin to compress and decompress (zip/unzip) files and folders in *.zip format.

Contributors are welcome.

Platforms supported

Installation

cordova plugin add cordova-zip-plugin

Easy Use


The object JJzip is expose in the window:

Methonds

Use Example

To Zip a folder

    var PathToFileInString  = cordova.file.externalRootDirectory+"HereIsMyFolder",
        PathToResultZip     = cordova.file.externalRootDirectory;
    JJzip.zip(PathToFileInString, {target:PathToResultZip,name:"SuperZip"},function(data){
        /* Wow everiting goes good, but just in case verify data.success*/
    },function(error){
        /* Wow something goes wrong, check the error.message */
    })

Or To UnZip

    var PathToFileInString  = cordova.file.externalRootDirectory+"HereIsMyFile.zip",
        PathToResultZip     = cordova.file.externalRootDirectory;
    JJzip.unzip(PathToFileInString, {target:PathToResultZip},function(data){
        /* Wow everything goes good, but just in case verify data.success */
    },function(error){
        /* Wow something goes wrong, check the error.message */
    })

There is a big TODO list, but in resume