mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-23 23:45:14 +00:00
First pass with zip
This commit is contained in:
11
docs/API.md
11
docs/API.md
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user