First pass with zip

This commit is contained in:
Adam Hathcock
2026-06-15 09:17:05 +01:00
parent c36a916c84
commit 2866bfbd54
24 changed files with 509 additions and 30 deletions

View File

@@ -320,7 +320,11 @@ var flatOptions = ExtractionOptions.FlatExtract; // No directory structure
var metadataOptions = ExtractionOptions.PreserveMetadata; // Keep timestamps and attributes
// Tune extraction copy buffering
var extractionOptions = new ExtractionOptions { BufferSize = 131072 };
var extractionOptions = new ExtractionOptions
{
BufferSize = 131072,
CheckCrc = true, // Default: validate entry checksums when archive metadata provides one
};
// Factory defaults:
// - file path / FileInfo overloads use LeaveStreamOpen = false
@@ -429,7 +433,8 @@ var options = new ExtractionOptions
{
ExtractFullPath = true, // Recreate directory structure
Overwrite = true, // Overwrite existing files
PreserveFileTime = true // Keep original timestamps
PreserveFileTime = true, // Keep original timestamps
CheckCrc = true // Validate payload checksums when available
};
using (var archive = ZipArchive.OpenArchive("file.zip"))
@@ -438,6 +443,8 @@ using (var archive = ZipArchive.OpenArchive("file.zip"))
}
```
`CheckCrc` validates archive-level payload checksums when the format stores reliable metadata, such as ZIP CRC32 values. Formats without payload checksums skip this validation. Decompressor integrity checks that are required to decode a stream may still fail even when `CheckCrc` is disabled.
### Options matrix
```text