BlueGit

blue-star danique-bot

Files

danique-bot / node_modules / extract-zip / readme.md

readme.md

Import template
timfa Tim · pushed by timfa · 4 years ago
c788ad20 History
readme.md 1.5 KiB Download Raw

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 ZIP parser.

NPM js-standard-style Build Status

Installation

Get the library:

npm install extract-zip --save

Install the command line program:

npm install extract-zip -g

JS API

var extract = require('extract-zip')
extract(source, {dir: target}, function (err) {
 // extraction is complete. make sure to handle the err
})

Options

  • dir - defaults to process.cwd()
  • defaultDirMode - integer - Directory Mode (permissions) will default to 493 (octal 0755 in integer)
  • defaultFileMode - integer - File Mode (permissions) will default to 420 (octal 0644 in integer)
  • 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
1# extract-zip
2
3Unzip written in pure JavaScript. Extracts a zip into a directory. Available as a library or a command line program.
4
5Uses the [`yauzl`](http://npmjs.org/yauzl) ZIP parser.
6
7[![NPM](https://nodei.co/npm/extract-zip.png?global=true)](https://nodei.co/npm/extract-zip/)
8[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
9[![Build Status](https://travis-ci.org/maxogden/extract-zip.svg?branch=master)](https://travis-ci.org/maxogden/extract-zip)
10
11## Installation
12
13Get the library:
14
15```
16npm install extract-zip --save
17```
18
19Install the command line program:
20
21```
22npm install extract-zip -g
23```
24
25## JS API
26
27```js
28var extract = require('extract-zip')
29extract(source, {dir: target}, function (err) {
30 // extraction is complete. make sure to handle the err
31})
32```
33
34### Options
35
36- `dir` - defaults to `process.cwd()`
37- `defaultDirMode` - integer - Directory Mode (permissions) will default to `493` (octal `0755` in integer)
38- `defaultFileMode` - integer - File Mode (permissions) will default to `420` (octal `0644` in integer)
39- `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
40
41Default modes are only used if no permissions are set in the zip file.
42
43## CLI Usage
44
45```
46extract-zip foo.zip <targetDirectory>
47```
48
49If not specified, `targetDirectory` will default to `process.cwd()`.