# extract-zip

> unzip a zip file into a directory using 100% javascript

Latest version **2.0.1** (published 2020-06-10) · BSD-2-Clause license · 0 weekly downloads

## Install

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

Provides the command `extract-zip`.

## Health

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

Positive: has types; high quality score.

Warnings: low downloads; no esm support; has vulnerabilities.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2020-06-10 |
| First published | 2014-10-17 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 10.17.0 |
| Dependencies | 4 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 2 |
| Install scripts | no |
| GitHub stars | 398 |
| Author | max ogden |
| Maintainers | malept, maxogden |
| Keywords | unzip, zip, extract |

## Links

- npm: https://www.npmjs.com/package/extract-zip
- Repository: https://github.com/maxogden/extract-zip
- Homepage: https://github.com/maxogden/extract-zip#readme
- Issues: https://github.com/maxogden/extract-zip/issues
- npm.io page: https://npm.io/package/extract-zip

## Dependencies (4)

- [debug](https://npm.io/package/debug.md) ^4.1.1
- [yauzl](https://npm.io/package/yauzl.md) ^2.10.0
- [get-stream](https://npm.io/package/get-stream.md) ^5.1.0
- [@types/yauzl](https://npm.io/package/@types/yauzl.md) ^2.9.1

## 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.1 (latest) — 2020-06-10
- 2.0.0 — 2020-03-28
- 1.7.0 — 2020-03-25
- 1.6.8 — 2020-03-24
- 1.6.7 — 2018-05-24
- 1.6.6 — 2017-10-31
- 1.6.5 — 2017-05-01
- 1.6.4 — 2017-04-29
- 1.6.3 — 2017-04-29
- 1.6.2 — 2017-04-29
- 1.6.1 — 2017-04-29
- 1.6.0 — 2016-12-21
- 1.5.0 — 2016-03-07
- 1.4.1 — 2016-01-04
- 1.4.0 — 2015-12-31
- … 9 more at https://npm.io/package/extract-zip/versions

## README

# extract-zip

Unzip written in pure JavaScript. Extracts a zip into a directory. Available as a library or a command line program.

Uses the [`yauzl`](http://npmjs.org/yauzl) ZIP parser.

[![NPM](https://nodei.co/npm/extract-zip.png?global=true)](https://npm.im/extract-zip)
[![Uses JS Standard Style](https://cdn.jsdelivr.net/gh/standard/standard/badge.svg)](https://github.com/standard/standard)
[![Build Status](https://github.com/maxogden/extract-zip/workflows/CI/badge.svg)](https://github.com/maxogden/extract-zip/actions?query=workflow%3ACI)

## Installation

Make sure you have Node 10 or greater installed.

Get the library:

```
npm install extract-zip --save
```

Install the command line program:

```
npm install extract-zip -g
```

## JS API

```javascript
const extract = require('extract-zip')

async function main () {
  try {
    await extract(source, { dir: target })
    console.log('Extraction complete')
  } catch (err) {
    // handle any errors
  }
}
```

### Options

- `dir` (required) - the path to the directory where the extracted files are written
- `defaultDirMode` - integer - Directory Mode (permissions), defaults to `0o755`
- `defaultFileMode` - integer - File Mode (permissions), defaults to `0o644`
- `onEntry` - function - if present, will be called with `(entry, zipfile)`, entry is every entry from the zip file forwarded from the `entry` event from yauzl. `zipfile` is the `yauzl` instance

Default modes are only used if no permissions are set in the zip file.

## CLI Usage

```
extract-zip foo.zip <targetDirectory>
```

If not specified, `targetDirectory` will default to `process.cwd()`.

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