# cordova-plugin-archive-zip

> Cordova Zip archive plugin with multipart support

Latest version **2.0.0** (published 2020-10-28) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install cordova-plugin-archive-zip
pnpm add cordova-plugin-archive-zip
yarn add cordova-plugin-archive-zip
bun add cordova-plugin-archive-zip
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-10-28 |
| First published | 2019-08-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 440.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | kitolog |
| Maintainers | kitolog |
| Keywords | cordova, zip, archive, multipart, ios zip, android zip, cordova zip, android archive, ios archive, cordova archive, cordova-android, cordova-ios |

## Links

- npm: https://www.npmjs.com/package/cordova-plugin-archive-zip
- Repository: https://github.com/kitolog/cordova-plugin-zip-archive
- Homepage: https://github.com/kitolog/cordova-plugin-zip-archive#readme
- Issues: https://github.com/kitolog/cordova-plugin-zip-archive
- npm.io page: https://npm.io/package/cordova-plugin-archive-zip

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2020-10-28
- 1.0.1 — 2019-08-21
- 1.0.0 — 2019-08-16

## README

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.

| parameter   | type          | description |
| ----------- |-----------------------------|--------------|
| `path`     | `string`                    | zip archive path | |
| `files`  | `string array`                    | path to files |
| `options`  | `options object or null`                    | path to files |
| `onSuccess` | `() => void`                | Success callback - called after archive was created. (optional)|
| `onError`   | `(message: string) => void` | Error callback - called when some error occurs during creating an archive. (optional)|

#### Options:
| parameter   | type          | description |
| ----------- |-----------------------------|--------------|
| `maxSize`      | `float`                | File 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

---
_Source: https://npm.io/package/cordova-plugin-archive-zip · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
