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 as NewZip without setting filename

Open Existing

  • OpenZip(path)
  • OpenFromMemory(...)
  • OpenBd(...)
Opening a ZIP automatically sets:
  • PasswordProtect
  • Encryption

Adding Content (Core Design)

There are two distinct models for adding content:

File-based

  • AddFile
  • AppendFiles
  • AppendFilesEx

In-memory / programmatic

  • AddData
  • AddBd
  • AddSb
  • AddString
  • AddEncoded

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 open
  • WriteZipAndClose() → 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

  • NumEntries
  • EntryAt
  • EntryById
  • EntryOf
  • EntryMatching

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 = 4
  • EncryptKeyLength = 128|192|256

️ These cannot be combined


Password Handling

  • EncryptPassword → for writing
  • DecryptPassword → for reading
  • VerifyPassword() → test correctness

Path Handling (Subtle but Important)

These properties control how paths appear inside the ZIP:

  • AppendFromDir
  • DiscardPaths
  • PathPrefix

These directly affect the internal ZIP directory structure.


Filtering / Selection

Time-based

  • MinDate
  • MaxDate

File selection

  • ExcludeDir
  • SetExclusions(...)

Attribute-based (Windows)

  • IgnoreAccessDenied
  • ClearArchiveAttribute

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 compression
  • ZipxDefaultAlg → fallback algorithm

Windows-Only: Self-Extracting EXEs

Huge feature set:

  • WriteExe, WriteExe2
  • AutoRun, AutoTemp
  • ExeNoInterface, ExeSilentProgress
  • Full XML config via ExeXmlConfig

This is essentially a ZIP + runtime wrapper


Async / Abort / Progress

  • AbortCurrent
  • HeartbeatMs
  • PercentDoneScale

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.)