# @tybys/cross-zip

> Cross-platform .zip file creation

Latest version **3.1.0** (published 2020-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tybys/cross-zip
pnpm add @tybys/cross-zip
yarn add @tybys/cross-zip
bun add @tybys/cross-zip
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2020-09-02 |
| First published | 2019-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | toyobayashi |
| Maintainers | toyobayashi |
| Keywords | ZIP, cross platform, cross-platform, linux, mac, os x, windows, zip |

## Links

- npm: https://www.npmjs.com/package/@tybys/cross-zip
- Repository: https://github.com/toyobayashi/cross-zip
- Issues: https://github.com/toyobayashi/cross-zip/issues
- npm.io page: https://npm.io/package/@tybys/cross-zip

## Dependencies (2)

- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.1
- [@tybys/oid](https://npm.io/package/@tybys/oid.md) ^3.0.0

## 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

- 3.1.0 (latest) — 2020-09-02
- 3.0.4 — 2020-02-17
- 3.0.3 — 2020-01-17
- 3.0.2 — 2020-01-17
- 3.0.1 — 2019-11-11
- 3.0.0 — 2019-11-11

## README

# cross-zip

[![Build status](https://travis-ci.com/toyobayashi/cross-zip.svg?branch=master)](https://travis-ci.com/toyobayashi/cross-zip/)

Fork from [https://github.com/feross/cross-zip](https://github.com/feross/cross-zip)

Cross-platform .zip file creation

## Install

```
npm install @tybys/cross-zip
```

## Usage

### JavaScript

``` js
const path = require('path')
const crossZip = require('@tybys/cross-zip')

const input = path.join(__dirname, 'myFolder') // folder to zip
const output = path.join(__dirname, 'myFile.zip') // name of output zip file

crossZip.zipSync(input, output)
```

### TypeScript

``` ts
import * as path from 'path'
import * as crossZip from '@tybys/cross-zip'

const input = path.join(__dirname, 'myFolder') // folder to zip
const output = path.join(__dirname, 'myFile.zip') // name of output zip file

crossZip.zipSync(input, output)
```

## API

### `crossZip.zip(input, output [, includeBaseDirectory])`

Zip the folder or file at `input` and save it to a .zip file at `output`. 

`includeBaseDirectory`: `true` to include the directory name from `input` at the root of the archive; `false` to include only the contents of the directory.

Return `Promise<number>` (size of archive).

### `crossZip.zipSync(input, output [, includeBaseDirectory])`

Sync version of `crossZip.zip`.

### `crossZip.unzip(input, output)`

Unzip the .zip file at `input` into the folder at `output`. Return `Promise<void>`.

### `crossZip.unzipSync(input, output)`

Sync version of `crossZip.unzip`.

## Windows users

This package requires [.NET Framework 4.5 or later](https://www.microsoft.com/net)
and [Powershell 3](https://www.microsoft.com/en-us/download/details.aspx?id=34595).
These come **pre-installed** on Windows 8 or later.

On Windows 7 or earlier, you will need to install these manually in order for
`cross-zip` to function correctly.

## Reference

- [Stack Overflow - zipping from command line in Windows](https://stackoverflow.com/questions/17546016/how-can-you-zip-or-unzip-from-the-command-prompt-using-only-windows-built-in-ca)

## License

MIT.

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