Interface: ZipOptions
zip.ZipOptions
Controls compression level, encryption, folder layout, and related flags when calling zipDir, zipFiles, zipFile, or ZipFile.add* helpers.
Example
const { zipDir } = require("zip");
zipDir("./dir", "./dest.zip", {
compressionLevel: 9,
password: "123456",
includeRootFolder: false,
});See also
Table of contents
Properties
- aesKeyStrength
- compressionLevel
- compressionMethod
- defaultFolderPath
- encryptionMethod
- fileNameInZip
- includeRootFolder
- password
- readHiddenFiles
- rootFolderInZip
Properties
aesKeyStrength
aesKeyStrength?:"AES_STRENGTH_128"|"AES_STRENGTH_192"|"AES_STRENGTH_256"
AES key size when using AES encryption.
compressionLevel
compressionLevel?:number
0–9: 0 = store only, 9 = strongest (slowest) DEFLATE. Sensible default is around 5.
compressionMethod
compressionMethod?:"COMP_STORE"|"COMP_DEFLATE"
COMP_STORE — pack without compression. COMP_DEFLATE — standard Zip DEFLate (default).
defaultFolderPath
defaultFolderPath?:string
Virtual folder prefix applied to entries when you add files without an explicit in-zip path.
encryptionMethod
encryptionMethod?:"ENC_NO_ENCRYPTION"|"ENC_METHOD_STANDARD"|"ENC_METHOD_AES"
ZipCrypto vs AES. ENC_NO_ENCRYPTION is the default. If you set password but omit this field, runtimes typically default to AES.
fileNameInZip
fileNameInZip?:string
Explicit path + name inside the archive for the next added file.
See also
includeRootFolder
includeRootFolder?:boolean
When true, the parent directory name of added files is preserved as a root folder inside the zip. Default true.
See also
password
password?:string
Password for encrypted output. Pair with encryptionMethod for reproducible behavior.
readHiddenFiles
readHiddenFiles?:boolean
Whether dot / hidden files are included when zipping a directory. Default true.
rootFolderInZip
rootFolderInZip?:string
Forces a top-level folder name inside the archive; created when absent.
See also
