ZIP Archives
The ZIP archive API separates inspection and extraction from creation.
ArchiveReader exposes an immutable directory and bounded
payload extraction, while ArchiveWriter appends entries to a
new archive and commits it only during finalization.
See Working with ZIP Archives for practical usage.
Supported Profile
The reader and writer support classic ZIP and ZIP64 with Stored, Deflate, bzip2, LZMA, and Zstandard entries.
File and archive comments use UTF-8, explicit directory entries represent local subdirectories, and modification times
use both the mandatory DOS fields and the Extended Timestamp field.
ZIP64 is detected and generated automatically; Zip64Policy::Always is useful for small interoperability fixtures,
while Zip64Policy::Never rejects a record before it would need ZIP64 fields.
The accepted profile contains one disk, starts with its first local header, and ends with its central-directory end
records.
Encryption, self-extracting prefixes, archive signatures, central-directory encryption, special filesystem entries, and
multi-disk archives are rejected with a structured ZipError.
Specification Mapping
The implementation targets PKWARE ZIP APPNOTE 6.3.10. Local file headers and data descriptors follow sections 4.3.7 and 4.3.9; central file headers follow section 4.3.12; ZIP64 end records and locators follow sections 4.3.14 and 4.3.15; the classic End of Central Directory follows section 4.3.16. ZIP64 extra-field substitution follows section 4.5.3, and Extended Timestamp interpretation follows section 4.5.5.
Reader and Item Lifetimes
Reader factories take ownership of stream inputs.
Stream-backed readers require an input that supports positioning; a transferred non-positionable stream is rejected and
closed.
Directory metadata is retained in each ArchiveItem and remains readable after close().
Compressed payloads are read from the owned stream only when an item is extracted or passed to addItem(), so these
operations fail after that reader closes or is destroyed.
close() is idempotent.
Writer Completion
New files and streams are compressed in bounded chunks.
A local header precedes the payload; a signed data descriptor records final lengths and CRC-32. ZIP64 sizes are reserved
before writing when an input length or compressed upper bound cannot prove classic fields sufficient.
Zip64Policy::Never rejects such entries before emission.
Any failure after entry emission starts aborts the writer.
finalize() writes the central directory, closes the stream, and is idempotent after success.
Path-backed writers use a sibling temporary file and leave an existing destination untouched until the completed archive
is moved into place.
abort() terminates output immediately.
Cleanup is enabled by default; when disabled, temporaryPath() identifies retained incomplete output for recovery.
Directory Pattern Filters
ArchiveDirectoryOptions::includeGlobs() and excludeGlobs() use
Path Glob Patterns against the complete normalized archive path.
The setters accept a compiled PathGlobPatternPtr, a String, or a StringList.
String setters compile immediately, enabling default trimming, recursive wildcards, and newline/semicolon alternatives.
List setters join their elements with ; and compile the resulting text with the same flags.
Use \; or [;] to represent a literal semicolon.
Malformed or empty pattern text raises ParseError in the setter and leaves the previous pattern intact.
An empty list or null pointer clears the corresponding filter.
A null include pattern accepts every entry, and exclusions take precedence over includes.
The getters return the compiled pointers, which are shared when options are copied and reused without recompilation.
Passing an already compiled pattern retains its selected compile flags.
**/*.txt includes both immediate and nested text files; * and ? stay within one component.
The source metadata callback runs only after the include/exclude decision accepts an entry.
Security Limits and Validation
Reader defaults bound the central directory to 64 MiB, item count to 100,000, one extracted item to 256 MiB, codec workspace to 64 MiB, and total bulk extraction to 1 GiB. Writer defaults bound whole-value fallback buffers to 256 MiB and item count to 100,000. Native streaming entries may exceed this buffering limit.
Opening reads one bounded archive tail, the fixed ZIP64 end record when present, and one bounded central-directory
block.
It validates end-record and central-directory boundaries with checked 64-bit arithmetic and rejects duplicate local
offsets, duplicate or colliding normalized paths, ambiguous entry types, unsupported flags, and trailing data after the
end record.
It does not visit local headers or payloads.
Arbitrary archive bytes are accepted as input to the reader factories.
Malformed records, unsupported features, unsafe paths, and configured-limit violations are reported as ZipError
runtime failures.
In particular, ZIP64 extra-field lengths are validated against the required replacement values before those values are
read.
Caller-precondition violations and exhausted system resources remain fatal failures.
When an item is accessed, the reader validates its local metadata and optional descriptor against the central directory,
then reads only the selected compressed payload in bounded chunks.
Every extraction then verifies the exact uncompressed length and CRC-32 before committing a file.
Memory use therefore depends on the bounded directory and the currently accessed item, not the total archive length.
extractToStream() borrows a destination and validates the complete entry before returning.
extract() still collects a complete value within maximumBufferedItemLength.
File extraction streams into a temporary file by default and commits only after successful integrity validation.
Raise total item and bulk-extraction limits explicitly when processing larger files.
Input/output stream settings configure timeouts for library-opened files; supplied streams keep their own settings.
Progress observers receive byte counts, item path, and operation phase and may cancel before completion.
Unknown extra fields are structurally validated and have no interpreted effect.
addItem() can retain them with the original compressed payload; path, UTF-8, timestamp, ZIP64, and other managed
fields are regenerated for the destination archive.
Names and comments are decoded as tolerant UTF-8. Invalid sequences become replacement characters; for paths, the
decoder’s U+FFFD sentinel is represented as U+FFFC so the normalized path remains usable and visibly substituted.
Interface
-
class ArchiveDirectoryOptions
Options for recursively adding a directory to a ZIP archive.
Globs match case-sensitively against normalized
/-separated archive paths;*and?stay within one path component while whole-component**matches zero or more components. Core sets and escapes are supported.See: Path Glob Patterns
Public Functions
-
inline bool recursive() const noexcept
Get whether traversal descends below immediate child directories.
-
inline ArchiveDirectoryOptions &setRecursive(bool value) noexcept
Set whether traversal descends below immediate child directories.
-
inline bool includeRootDirectory() const noexcept
Get whether the source directory itself is stored as the leading component.
-
inline ArchiveDirectoryOptions &setIncludeRootDirectory(bool value) noexcept
Set whether the source directory itself is stored as the leading component.
-
inline const path::PathGlobPatternPtr &includeGlobs() const noexcept
Get the compiled include patterns; null accepts every path.
-
inline ArchiveDirectoryOptions &setIncludeGlobs(path::PathGlobPatternPtr value) noexcept
Replace the include patterns; null disables inclusion filtering.
-
ArchiveDirectoryOptions &setIncludeGlobs(const text::String &value)
Compile include patterns, preserving the previous value on failure.
- Parameters:
value – Semicolon- or newline-separated patterns with default trimming and recursive wildcards.
- Throws:
err::ParseError – If the pattern text is invalid or contains no alternatives.
-
ArchiveDirectoryOptions &setIncludeGlobs(const text::StringList &value)
Join include patterns with semicolons and compile them; an empty list clears the filter.
- Parameters:
value – Pattern sources, interpreted together as semicolon-separated alternatives.
- Throws:
err::ParseError – If the joined pattern text is invalid; the previous value remains intact.
-
inline const path::PathGlobPatternPtr &excludeGlobs() const noexcept
Get the compiled exclude patterns; null excludes no paths.
-
inline ArchiveDirectoryOptions &setExcludeGlobs(path::PathGlobPatternPtr value) noexcept
Replace the exclude patterns; null disables exclusion filtering.
-
ArchiveDirectoryOptions &setExcludeGlobs(const text::String &value)
Compile exclude patterns, preserving the previous value on failure.
- Parameters:
value – Semicolon- or newline-separated patterns with default trimming and recursive wildcards.
- Throws:
err::ParseError – If the pattern text is invalid or contains no alternatives.
-
ArchiveDirectoryOptions &setExcludeGlobs(const text::StringList &value)
Join exclude patterns with semicolons and compile them; an empty list clears the filter.
- Parameters:
value – Pattern sources, interpreted together as semicolon-separated alternatives.
- Throws:
err::ParseError – If the joined pattern text is invalid; the previous value remains intact.
-
inline const Filter &filter() const noexcept
Get the optional source-path and metadata callback.
-
inline ArchiveDirectoryOptions &setFilter(Filter value) noexcept
Set the optional source-path and metadata callback.
-
inline const ArchiveEntryOptions &entryOptions() const noexcept
Get the defaults applied to accepted regular files.
-
inline ArchiveDirectoryOptions &setEntryOptions(ArchiveEntryOptions value) noexcept
Set the defaults applied to accepted regular files.
-
inline bool recursive() const noexcept
-
class ArchiveEntryOptions
Optional per-entry overrides for an archive writer.
Public Functions
-
inline const std::optional<CompressionMethod> &compressionMethod() const noexcept
Get the optional per-entry compression-method override.
-
inline ArchiveEntryOptions &setCompressionMethod(CompressionMethod value) noexcept
Set the per-entry compression-method override.
-
inline const std::optional<compression::CompressionLevel> &compressionLevel() const noexcept
Get the optional per-entry compression-level override.
-
inline ArchiveEntryOptions &setCompressionLevel(compression::CompressionLevel value) noexcept
Set the per-entry compression-level override.
-
inline const std::optional<time::Timestamp> &modificationTime() const noexcept
Get the optional per-entry modification-time override.
-
inline ArchiveEntryOptions &setModificationTime(time::Timestamp value) noexcept
Set the per-entry modification-time override.
-
inline const std::optional<text::String> &comment() const noexcept
Get the optional per-entry comment override.
-
inline ArchiveEntryOptions &setComment(text::String value) noexcept
Set the per-entry comment override.
-
inline const std::optional<CompressionMethod> &compressionMethod() const noexcept
-
class ArchiveExtractionOptions
Options for safely extracting one or more ZIP entries.
Public Functions
-
inline const stream::OutputStreamSettings &outputStreamSettings() const noexcept
Get settings for library-opened output streams.
-
inline ArchiveExtractionOptions &setOutputStreamSettings(stream::OutputStreamSettings value)
Set settings for library-opened output streams.
-
inline const ZipProgressFn &progress() const noexcept
Get the synchronous entry progress observer.
-
inline ArchiveExtractionOptions &setProgress(ZipProgressFn value)
Set the synchronous entry progress observer.
-
inline path::PathCollisionMode collisionMode() const noexcept
Get the behavior for an existing destination path.
-
inline ArchiveExtractionOptions &setCollisionMode(path::PathCollisionMode value) noexcept
Set the behavior for an existing destination path.
-
inline bool preserveModificationTime() const noexcept
Get whether a valid archive modification time is restored.
-
inline ArchiveExtractionOptions &setPreserveModificationTime(bool value) noexcept
Set whether a valid archive modification time is restored.
-
inline bool useAtomicFiles() const noexcept
Get whether files are committed through sibling temporary files.
-
inline ArchiveExtractionOptions &setUseAtomicFiles(bool value) noexcept
Set whether files are committed through sibling temporary files.
-
inline unit::ByteCount maximumLength() const noexcept
Get the maximum uncompressed length for this extraction.
-
inline ArchiveExtractionOptions &setMaximumLength(unit::ByteCount value) noexcept
Set the maximum uncompressed length for this extraction.
-
inline const stream::OutputStreamSettings &outputStreamSettings() const noexcept
-
class ArchiveItem
Immutable metadata and extraction access for one ZIP archive entry.
Metadata remains available after its reader closes; payload operations require the reader to remain open.
See: ZIP Archives
Subclassed by erbsland::compression::zip::impl::ArchiveItem
Public Functions
-
virtual void extractToStream(stream::ByteOutputStream &destination, ArchiveExtractionOptions options = {}) const = 0
Decode into a borrowed stream; output is provisional until integrity validation succeeds.
-
virtual bool isDirectory() const noexcept = 0
Test whether this is an explicit directory entry.
-
virtual CompressionMethod compressionMethod() const noexcept = 0
Get the method used for this entry payload.
-
virtual const time::Timestamp &lastModificationTime() const noexcept = 0
Get the preferred Extended Timestamp or DOS fallback modification time.
-
virtual uint32_t crc32() const noexcept = 0
Get the declared CRC-32 of the uncompressed bytes.
-
virtual unit::ByteCount compressedLength() const noexcept = 0
Get the declared compressed payload length.
-
virtual unit::ByteCount uncompressedLength() const noexcept = 0
Get the declared uncompressed payload length.
-
virtual const text::String &comment() const noexcept = 0
Get the entry comment decoded as tolerant UTF-8.
-
virtual mem::ByteBlock extract(unit::ByteCount maximumLength) const = 0
Extract and validate this entry into memory.
- Throws:
ZipError – If the reader is closed, the limit is exceeded, decoding fails, or CRC/length validation fails.
-
virtual void extractToFile(const path::Path &destination, ArchiveExtractionOptions options = {}) const = 0
Extract a file entry to an explicit destination path.
-
virtual void extractToDirectory(const path::Path &root, ArchiveExtractionOptions options = {}) const = 0
Extract this entry below a root while retaining its archive path.
-
virtual void extractToStream(stream::ByteOutputStream &destination, ArchiveExtractionOptions options = {}) const = 0
-
class ArchiveReader
A synchronous, inspection-and-extraction interface for one ZIP archive.
Parsing follows APPNOTE 6.3.10 sections 4.3.12 through 4.3.16 and 4.5.3.
See: ZIP Archives
Archive operations are unsuitable for sensitive data; codec storage is not securely erased.Subclassed by erbsland::compression::zip::impl::ArchiveReader
Public Functions
-
virtual unit::ItemCount itemCount() const noexcept = 0
Get the number of validated central-directory entries.
-
virtual ArchiveItemPtr item(unit::ItemIndex index) const noexcept = 0
Get one entry, or null when the index is outside the directory.
-
virtual ArchiveItemList items() const = 0
Get a copy of the validated entries in central-directory order.
-
virtual const text::String &comment() const noexcept = 0
Get the archive comment decoded as tolerant UTF-8.
-
virtual bool isZip64() const noexcept = 0
Test whether this archive uses ZIP64 records or fields.
-
virtual void extractToDirectory(const path::Path &root, ArchiveExtractionOptions options = {}, Filter filter = {}) const = 0
Extract every entry accepted by the optional filter below one output root.
-
virtual void close() noexcept = 0
Close the owned input stream; repeated calls have no effect.
-
virtual bool isOpen() const noexcept = 0
Test whether payload operations can still access the owned input stream.
Public Static Functions
-
static ArchiveReaderPtr create(const path::Path &source, ArchiveReaderOptions options = {})
Open and own a path-backed ZIP archive.
- Parameters:
source – The archive file to open.
options – The archive-reading limits and options.
- Throws:
ZipError – If input is malformed, unsupported, unsafe, exceeds configured limits, or cannot be read.
- Returns:
An open reader with a validated central directory; local records and payloads are checked on access.
-
static ArchiveReaderPtr create(mem::ByteBlock source, ArchiveReaderOptions options = {})
Open and own an in-memory ZIP archive.
- Parameters:
source – The complete archive bytes to inspect.
options – The archive-reading limits and options.
- Throws:
ZipError – If input is malformed, unsupported, unsafe, or exceeds configured limits.
- Returns:
An open reader with a validated central directory; local records and payloads are checked on access.
-
static auto create(stream::ByteInputStreamPtr source, ArchiveReaderOptions options = {}) -> ArchiveReaderPtr
Open and own a ZIP archive input stream.
- Parameters:
source – The archive input stream. Must not be null and must support positioning.
options – The archive-reading limits and options.
- Throws:
ZipError – If input is malformed, unsupported, unsafe, exceeds configured limits, or cannot be read.
- Returns:
An open reader with a validated central directory; local records and payloads are checked on access.
-
virtual unit::ItemCount itemCount() const noexcept = 0
-
class ArchiveReaderOptions
Security and resource limits used while opening and reading a ZIP archive.
Public Functions
-
inline unit::ByteCount maximumBufferedItemLength() const noexcept
Get the maximum complete in-memory item value.
-
inline ArchiveReaderOptions &setMaximumBufferedItemLength(unit::ByteCount value)
Set the complete item buffering limit independently of total output limits.
-
inline const stream::InputStreamSettings &inputStreamSettings() const noexcept
Get settings for library-opened input streams.
-
inline ArchiveReaderOptions &setInputStreamSettings(stream::InputStreamSettings value)
Set settings for library-opened input streams.
-
inline const ZipProgressFn &progress() const noexcept
Get the synchronous entry progress observer.
-
inline ArchiveReaderOptions &setProgress(ZipProgressFn value)
Set the synchronous entry progress observer.
-
inline unit::ByteCount maximumCentralDirectoryLength() const noexcept
Get the maximum central-directory byte length.
-
inline ArchiveReaderOptions &setMaximumCentralDirectoryLength(unit::ByteCount value) noexcept
Set the maximum central-directory byte length.
-
inline unit::ItemCount maximumItemCount() const noexcept
Get the maximum number of entries accepted from the directory.
-
inline ArchiveReaderOptions &setMaximumItemCount(unit::ItemCount value) noexcept
Set the maximum number of entries accepted from the directory.
-
inline unit::ByteCount maximumItemLength() const noexcept
Get the maximum uncompressed length of one extracted item.
-
inline ArchiveReaderOptions &setMaximumItemLength(unit::ByteCount value) noexcept
Set the maximum uncompressed length of one extracted item.
-
inline unit::ByteCount maximumCodecWorkspace() const noexcept
Get the maximum decoder workspace length.
-
inline ArchiveReaderOptions &setMaximumCodecWorkspace(unit::ByteCount value) noexcept
Set the maximum decoder workspace length.
-
inline unit::ByteCount maximumBulkExtractionLength() const noexcept
Get the maximum total declared output for one bulk extraction.
-
inline ArchiveReaderOptions &setMaximumBulkExtractionLength(unit::ByteCount value) noexcept
Set the maximum total declared output for one bulk extraction.
-
inline unit::ByteCount maximumBufferedItemLength() const noexcept
-
class ArchiveWriter
A synchronous, append-and-finalize interface for creating one ZIP archive.
Record emission follows APPNOTE 6.3.10 sections 4.3.6 through 4.3.16 and 4.5.3.
See: ZIP Archives
Archive operations are unsuitable for sensitive data; codec storage is not securely erased.Subclassed by erbsland::compression::zip::impl::ArchiveWriter
Public Functions
-
virtual void setCompressionMethod(CompressionMethod value) = 0
Set the compression method used by subsequent entries without an override.
-
virtual void setCompressionLevel(compression::CompressionLevel value) = 0
Set the compression effort used by subsequent entries without an override.
-
virtual void setBaseDirectory(path::Path value) = 0
Set the directory removed from implicit
addFile()storage paths.
-
virtual void setComment(text::String value) = 0
Set the archive comment encoded into the final EOCD record.
-
virtual void setCleanupEnabled(bool value) noexcept = 0
Set whether an unfinished path-backed temporary archive is removed.
-
virtual void addFile(const path::Path &source, const path::Path &storagePath = {}, ArchiveEntryOptions options = {}) = 0
Read, compress, and add one regular file.
-
virtual void addData(const mem::ByteBlock &data, const path::Path &storagePath, ArchiveEntryOptions options = {}) = 0
Compress and add one in-memory item.
-
virtual void addStream(stream::ByteInputStreamPtr source, const path::Path &storagePath, ArchiveEntryOptions options = {}, unit::ByteCount length = unit::ByteCount::infinite()) = 0
Own and consume all or an exact prefix of an input stream, then close it.
-
virtual void addDirectory(const path::Path &source, ArchiveDirectoryOptions options = {}) = 0
Traverse and add a directory according to the supplied filters.
-
virtual void addItem(const ArchiveItem &source) = 0
Copy one compressed payload and its opaque extra fields without decoding it.
-
virtual void finalize() = 0
Write directory/end records, close the stream, and atomically commit a path destination.
-
virtual void abort() noexcept = 0
Immediately abandon the writer and apply its cleanup policy.
-
virtual bool isFinalized() const noexcept = 0
Test whether finalization completed successfully.
Public Static Functions
-
static auto create(const path::Path &destination, ArchiveWriterOptions options = {}) -> ArchiveWriterPtr
Create a path-backed writer using a sibling temporary archive.
-
static auto create(stream::ByteOutputStreamPtr destination, ArchiveWriterOptions options = {}) -> ArchiveWriterPtr
Create a writer that owns the supplied output stream.
-
virtual void setCompressionMethod(CompressionMethod value) = 0
-
class ArchiveWriterOptions
Security and resource limits used while creating a ZIP archive.
Public Functions
-
inline const stream::InputStreamSettings &inputStreamSettings() const noexcept
Get settings for library-opened input streams.
-
inline ArchiveWriterOptions &setInputStreamSettings(stream::InputStreamSettings value)
Set settings for library-opened input streams.
-
inline const stream::OutputStreamSettings &outputStreamSettings() const noexcept
Get settings for library-opened output streams.
-
inline ArchiveWriterOptions &setOutputStreamSettings(stream::OutputStreamSettings value)
Set settings for library-opened output streams.
-
inline const ZipProgressFn &progress() const noexcept
Get the synchronous entry progress observer.
-
inline ArchiveWriterOptions &setProgress(ZipProgressFn value)
Set the synchronous entry progress observer.
-
inline Zip64Policy zip64Policy() const noexcept
Get the policy controlling classic ZIP and ZIP64 record emission.
-
inline ArchiveWriterOptions &setZip64Policy(Zip64Policy value) noexcept
Set the policy controlling classic ZIP and ZIP64 record emission.
-
inline unit::ByteCount maximumBufferedItemLength() const noexcept
Get the maximum bytes buffered for one uncompressed or compressed entry.
-
inline ArchiveWriterOptions &setMaximumBufferedItemLength(unit::ByteCount value) noexcept
Set the maximum bytes buffered for one uncompressed or compressed entry.
-
inline unit::ItemCount maximumItemCount() const noexcept
Get the maximum number of entries written into the archive.
-
inline ArchiveWriterOptions &setMaximumItemCount(unit::ItemCount value) noexcept
Set the maximum number of entries written into the archive.
-
inline const stream::InputStreamSettings &inputStreamSettings() const noexcept
-
enum class erbsland::compression::zip::CompressionMethod : uint16_t
A compression method in a ZIP archive.
Values:
-
enumerator Stored
APPNOTE method 0, stored without compression.
-
enumerator Deflate
APPNOTE method 8, Deflate.
-
enumerator Bzip2
APPNOTE method 12, Bzip2.
-
enumerator Lzma
APPNOTE method 14, LZMA.
-
enumerator Zstandard
APPNOTE method 93, Zstandard.
-
enumerator Stored
-
enum class erbsland::compression::zip::Zip64Policy : uint8_t
Control when writers emit ZIP64 records and sentinel fields.
Values:
-
enumerator Automatic
Emit ZIP64 only where classic fields are insufficient.
-
enumerator Always
Emit ZIP64 records even for small archives.
-
enumerator Never
Reject entries before a ZIP64-only record would be written.
-
enumerator Automatic
-
class ZipError : public erbsland::err::RuntimeError
A malformed, unsupported, unsafe, or failed ZIP archive operation.
Public Functions
-
explicit ZipError(ZipErrorContext context, std::exception_ptr cause = {}) noexcept
Create a ZIP error and retain an optional lower-level cause.
-
virtual err::DiagnosticConstPtr diagnostic() const override
Build a user-facing diagnostic containing all available path context.
-
inline const ZipErrorContext &context() const noexcept
Get the complete structured error context.
-
inline ZipErrorReason reasonCode() const noexcept
Get the machine-readable failure reason.
-
inline ZipOperationPhase phase() const noexcept
Get the operation phase that failed.
-
explicit ZipError(ZipErrorContext context, std::exception_ptr cause = {}) noexcept
-
class ZipErrorContext
User-facing context for a ZIP archive failure.
Public Functions
-
inline explicit ZipErrorContext(ZipErrorReason reason, ZipOperationPhase phase, text::String title, text::String description = {}) noexcept
Create ZIP failure context with machine-readable and user-facing fields.
-
inline ZipErrorReason reason() const noexcept
Get the machine-readable failure reason.
-
inline ZipOperationPhase phase() const noexcept
Get the operation phase that failed.
-
inline const text::String &description() const noexcept
Get the user-facing explanation of why it failed.
-
inline const path::Path &sourcePath() const noexcept
Get the optional archive or input source path.
-
inline const path::Path &destinationPath() const noexcept
Get the optional archive or extraction destination path.
-
inline ZipErrorContext &setSourcePath(path::Path value) noexcept
Set the archive or input source path.
-
inline ZipErrorContext &setDestinationPath(path::Path value) noexcept
Set the archive or extraction destination path.
-
inline ZipErrorContext &setItemPath(path::Path value) noexcept
Set the normalized archive item path.
-
inline explicit ZipErrorContext(ZipErrorReason reason, ZipOperationPhase phase, text::String title, text::String description = {}) noexcept
-
enum class erbsland::compression::zip::ZipErrorReason : uint8_t
A machine-readable ZIP archive failure reason.
Values:
-
enumerator MalformedArchive
A record is truncated, inconsistent, or otherwise malformed.
-
enumerator UnsupportedFeature
A recognized ZIP feature is outside the supported profile.
-
enumerator UnsupportedMethod
An entry uses an unsupported compression method.
-
enumerator ResourceLimit
A configured archive, item, workspace, or output limit was exceeded.
-
enumerator IntegrityFailure
An extracted length or CRC-32 does not match the directory metadata.
-
enumerator UnsafePath
An entry path is non-portable or unsafe for extraction.
-
enumerator PathFailure
A filesystem operation failed.
-
enumerator StreamFailure
An archive stream failed or timed out.
-
enumerator CodecFailure
Compression or decompression failed.
-
enumerator MalformedArchive
-
enum class erbsland::compression::zip::ZipOperationPhase : uint8_t
The archive operation phase in which a ZIP failure occurred.
Values:
-
enumerator Open
Opening or buffering an archive.
-
enumerator Directory
Locating or parsing the central directory.
-
enumerator LocalHeader
Validating a local file header.
-
enumerator Payload
Reading or copying compressed payload data.
-
enumerator Decompression
Decompressing and validating an item.
-
enumerator Extraction
Committing extracted filesystem content.
-
enumerator Compression
Compressing a new item.
-
enumerator Finalization
Writing directory/end records or committing an archive.
-
enumerator DirectoryTraversal
Traversing source files for
addDirectory().
-
enumerator Open
-
struct ZipProgress
Progress of one ZIP entry operation.
Public Members
-
CompressionProgress transfer
Cumulative entry byte counts.
-
ZipOperationPhase phase
Archive operation producing this update.
-
CompressionProgress transfer
-
using erbsland::compression::zip::ZipProgressFn = std::function<CompressionProgressAction(const ZipProgress&)>
Synchronous entry observer with cancellation support.