Socket
Socket
Sign inDemoInstall

cordova-zip-plugin

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cordova-zip-plugin

Cordova zip compress and decompress


Version published
Maintainers
1
Install size
23.2 kB
Created

Readme

Source

Zip / UnZip plugin

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

Contributors are welcome.

Platforms supported

  • android
  • iOS (On top of: SSZipArchive.)

Installation

cordova plugin add cordova-zip-plugin

Easy Use

The object JJzip is expose in the window:

Methonds

  • zip(file [, options, successCallback, errorCallback]) - Allow to zip a file or folder (Android only)
    • file - Path/To/File/Or/Folder
    • options - Compression options in a JS object format (Key:"value")
      • target: Path/To/Place/Result
      • name: Name of the resulted zip (without the .zip)
    • successCallback - Function to call in plugin success
    • errorCallback - Function to call in plugin error
  • unzip(file [, options, successCallback, errorCallback]) - Allow to unzip a zip file
    • file - Path/To/File.zip (Expect a cordova style path file://)
    • options - Extra options in a JS object format (Key:"value")
      • target: Path/To/Place/Result
    • successCallback - Function to call in plugin success
    • errorCallback - Function to call in plugin error

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

  • Write a better documentation
  • Add iOS Support (Partial support, only unzip)
  • Should handle some file manipulation (Like remove after zip the file?)

Keywords

FAQs

Last updated on 16 Apr 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc