# nativescript-zip

> A simple utility class for zipping and unzipping files in NativeScript

Latest version **4.0.2** (published 2019-12-04) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install nativescript-zip
pnpm add nativescript-zip
yarn add nativescript-zip
bun add nativescript-zip
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2019-12-04 |
| First published | 2017-02-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 122 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Osei Fortune |
| Maintainers | ddaf, triniwiz |
| Keywords | NativeScript, JavaScript, Android, iOS, Zip |

## Links

- npm: https://www.npmjs.com/package/nativescript-zip
- Homepage: https://github.com/triniwiz/nativescript-zip
- Issues: https://github.com/triniwiz/nativescript-zip/issues
- npm.io page: https://npm.io/package/nativescript-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

- 4.0.2 (latest) — 2019-12-04
- 4.0.1 — 2019-12-04
- 4.0.0 — 2019-12-04
- 3.0.3 — 2019-05-18
- 3.0.2 — 2019-03-07
- 3.0.1 — 2019-03-07
- 3.0.0 — 2018-04-17
- 2.0.4 — 2018-03-20
- 2.0.3 — 2018-02-20
- 2.0.2 — 2018-02-03
- 2.0.1 — 2018-02-03
- 2.0.0 — 2018-02-03
- 1.3.5 — 2018-01-02
- 1.3.4 — 2017-12-19
- 1.3.3 — 2017-12-11
- … 8 more at https://npm.io/package/nativescript-zip/versions

## README

[![npm](https://img.shields.io/npm/v/nativescript-zip.svg)](https://www.npmjs.com/package/nativescript-zip)
[![npm](https://img.shields.io/npm/dt/nativescript-zip.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-zip)
[![Build Status](https://travis-ci.org/triniwiz/nativescript-zip.svg?branch=master)](https://travis-ci.org/triniwiz/nativescript-zip)

# NativeScript Zip

## Installation

#### NativeScript 4x

* `tns plugin add nativescript-zip`


#### NativeScript 2x & 3x

* `tns plugin add nativescript-zip@2.0.4`


## Usage

### Zip

```typescript
import { Zip } from "nativescript-zip";
import * as fs from "tns-core-modules/file-system";
let path = fs.path.join(fs.knownFolders.temp().path, "stuff");
let dest = fs.path.join(fs.knownFolders.documents().path, "/assets");
Zip.zip({
    folder: path,
    destination: dest
});
```

#### Progress

```typescript
import { Zip } from "nativescript-zip";
import * as fs from "tns-core-modules/file-system";
let path = fs.path.join(fs.knownFolders.temp().path, "stuff");
let dest = fs.path.join(fs.knownFolders.documents().path, "/assets");
Zip.zip({
    folder: path,
    destination: dest,
    onProgress: onZipProgress
});

function onZipProgress(percent: number) {
    console.log(`unzip progress: ${percent}`);
}
```

### Unzip

```typescript
import { Zip } from "nativescript-zip";
import * as fs from "tns-core-modules/file-system";
let zipPath = fs.path.join(fs.knownFolders.temp().path, "stuff.zip");
let dest = fs.path.join(fs.knownFolders.documents().path, "/assets");
Zip.unzip({
    archive: zipPath,
    destination: dest
});
```

#### Progress

```typescript
import { Zip } from "nativescript-zip";
import * as fs from "tns-core-modules/file-system";
let zipPath = fs.path.join(fs.knownFolders.temp().path, "stuff.zip");
let dest = fs.path.join(fs.knownFolders.documennts().path, "/assets");
Zip.unzip({
    archive: zipPath,
    destination: dest,
    onProgress: onUnZipProgress
});

function onUnZipProgress(percent: number) {
    console.log(`unzip progress: ${percent}`);
}
```

# TODO

* [x] Compress method
* [x] Progress

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