Chilkat Zip Class Overview
Instead of thinking in terms of a long flat list of properties/methods, it helps to group the class into functional areas.
Object Lifecycle
Initialize / Reset
NewZip(path)→ start a new ZIP (clears everything)CloseZip()→ same effect asNewZipwithout setting filename
Open Existing
OpenZip(path)OpenFromMemory(...)OpenBd(...)
Opening a ZIP automatically sets:
PasswordProtectEncryption
Adding Content (Core Design)
There are two distinct models for adding content:
File-based
AddFileAppendFilesAppendFilesEx
In-memory / programmatic
AddDataAddBdAddSbAddStringAddEncoded
Structural
AddEmpty(file or directory)
️ Important Design Rule
These methods do NOT write the ZIP immediately They only modify the in-memory ZIP object.
You must call:
WriteZip- or
WriteZipAndClose
This is explicitly stated for methods like AppendFiles
Writing Output
File-based
WriteZip()→ save and keep openWriteZipAndClose()→ save and reset
Memory-based
WriteToMemory()WriteBd(...)
Special
QuickAppend(zipFile)→ append efficiently to existing ZIP
Extraction
Full extraction
Unzip(dir)UnzipNewer(dir)
Flattened extraction
UnzipInto(dir)(ignores stored paths)
Filtered
UnzipMatching(dir, pattern, verbose)UnzipMatchingInto(...)
Entry Access Model
Two levels:
Zip level
NumEntriesEntryAtEntryByIdEntryOfEntryMatching
Entry level (ZipEntry)
- Used for:
- extraction
- inspection
- deletion (
DeleteEntry)
Encryption Model (Important)
There are two mutually exclusive systems:
Old Zip 2.0
PasswordProtect = true
Modern AES (WinZip-compatible)
Encryption = 4EncryptKeyLength = 128|192|256
️ These cannot be combined
Password Handling
EncryptPassword→ for writingDecryptPassword→ for readingVerifyPassword()→ test correctness
Path Handling (Subtle but Important)
These properties control how paths appear inside the ZIP:
AppendFromDirDiscardPathsPathPrefix
These directly affect the internal ZIP directory structure.
Filtering / Selection
Time-based
MinDateMaxDate
File selection
ExcludeDirSetExclusions(...)
Attribute-based (Windows)
IgnoreAccessDeniedClearArchiveAttribute
Compression Control
SetCompressionLevel(0–9)AddNoCompressExtension(...)
Default behavior:
- Certain file types (jpg, zip, etc.) are stored, not compressed
ZIP64 + Large Files
- Automatically used when needed
- Can force:
UncommonOptions = "ForceZip64"
ZIPX Support
Zipx = true→ auto-select best compressionZipxDefaultAlg→ fallback algorithm
Windows-Only: Self-Extracting EXEs
Huge feature set:
WriteExe,WriteExe2AutoRun,AutoTempExeNoInterface,ExeSilentProgress- Full XML config via
ExeXmlConfig
This is essentially a ZIP + runtime wrapper
Async / Abort / Progress
AbortCurrentHeartbeatMsPercentDoneScale
Diagnostics
LastErrorText(critical for debugging)
Key Behavioral Insights
“Build → then Write”
The Zip object is a staging container, not a streaming writer.
File vs Data symmetry
Almost everything has both:
- file-based API
- memory-based API
ZIP is mutable in-memory
You can:
- add
- delete
- update
before committing.
Encryption is stateful
Opening a ZIP sets encryption mode automatically.
Extraction behavior is highly configurable
(flattening, filtering, overwrite rules, etc.)