@janpio/cross-zip
v3.1.0
Published
Cross-platform .zip file creation
Downloads
4
Maintainers
Readme
cross-zip
Fork from https://github.com/feross/cross-zip
Cross-platform .zip file creation
Install
npm install @tybys/cross-zip
Usage
JavaScript
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
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 and Powershell 3. 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
License
MIT.