333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# cross-zip [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
 
[travis-image]: https://img.shields.io/travis/feross/cross-zip/master.svg
[travis-url]: https://travis-ci.org/feross/cross-zip
[npm-image]: https://img.shields.io/npm/v/cross-zip.svg
[npm-url]: https://npmjs.org/package/cross-zip
[downloads-image]: https://img.shields.io/npm/dm/cross-zip.svg
[downloads-url]: https://npmjs.org/package/cross-zip
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
 
### Cross-platform .zip file creation
 
## install
 
```
npm install cross-zip
```
 
## usage
 
```js
var zip = require('cross-zip')
 
var inPath = path.join(__dirname, 'myFolder') // folder to zip
var outPath = path.join(__dirname, 'myFile.zip') // name of output zip file
 
zip.zipSync(inPath, outPath)
```
 
## api
 
### `zip.zip(inPath, outPath, [callback])`
 
Zip the folder at `inPath` and save it to a .zip file at `outPath`. If a `callback`
is passed, then it is called with an `Error` or `null`.
 
### `zip.zipSync(inPath, outPath)`
 
Sync version of `zip.zip`.
 
### `zip.unzip(inPath, outPath, [callback])`
 
Unzip the .zip file at `inPath` into the folder at `outPath`. If a `callback` is
passed, then it is called with an `Error` or `null`.
 
### `zip.unzipSync(inPath, outPath)`
 
Sync version of `zip.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)
 
## related
 
- [cross-zip-cli](https://github.com/jprichardson/cross-zip-cli): CLI version of cross-zip.
 
## license
 
MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).