Socket
Book a DemoInstallSign in
Socket

cordova-plugin-archive-zip

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-archive-zip

Cordova Zip archive plugin with multipart support

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
2
-50%
Maintainers
1
Weekly downloads
 
Created
Source

cordova-plugin-archive-zip

Cordova plugin to create zip archive

Installation

cordova plugin add cordova-plugin-archive-zip

// you may also install directly from this repo cordova plugin add https://github.com/kitolog/cordova-plugin-zip-archive

Sample usage

Here is simple example of how to zip files

Create instance of Zip plugin:

var zipInstance = new window.zipArchive()

Set data consumer, error and close handlers:

zipInstance.onError = function(errorMessage) {
  // invoked after error occurs
};

Archive files

zipInstance.zip('/PATH/TO/NEW/ARCHIVE.zip',
    ['/PATH/TO/FILE1.txt',
     '/PATH/TO/FILE2.txt'
     '/PATH/TO/FILE3.txt'
     '/PATH/TO/FILE4.csv'
    ], 
    () => {
    // zip archive created
    },
    (error) => {
    // handle errors
    })

API

Event handlers

onError: (message: string) => void

Invoked when some error occurs during zip process.

on: (eventName: string, callback: function) => void

Syntax sugar for the event handlers (onTick, onStop, onError) eventName: error

Methods

zip(path, files, options, onSuccess?, onError?): void

Establishes connection with the remote host.

parametertypedescription
pathstringzip archive path
filesstring arraypath to files
optionsoptions object or nullpath to files
onSuccess() => voidSuccess callback - called after archive was created. (optional)
onError(message: string) => voidError callback - called when some error occurs during creating an archive. (optional)

Options:

parametertypedescription
maxSizefloatFile size, in Mb. Default 0 - no max size

What's new

  • 1.0.0 - initial code
  • 1.0.1 - cleared zip instances
  • 2.0.0 - added max file size and zip parts support, updated SSZipArchive version

Keywords

cordova

FAQs

Package last updated on 28 Oct 2020

Did you know?

Socket

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