ArchiveExtractor
OfficeIMO.Archives
Extracts one managed archive container into a fresh directory without executing its contents.
Inheritance
- object
- ArchiveExtractor
Methods
public static ArchiveExtractionResult Extract(string packagePath, string destinationDirectory, ArchiveExtractionOptions? options = null, CancellationToken cancellationToken = default) #Verifies and extracts selected files from a ZIP, 7z, RAR5, CAB, ordinary MSI, TAR, .tar.gz or single-file gzip package. TAR symbolic links, hard links and device records are never created; selecting one fails the extraction. A gzip file is extracted under its stored name, or the package name without ".gz". The destination must be absent or empty. A completed staging directory is published by a same-volume move.
Parameters
- packagePath string
- destinationDirectory string
- options OfficeIMO.Archives.ArchiveExtractionOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ArchiveExtractionResultExceptions
OfficeInspectionResourceLimitException– A configured or fixed managed admission ceiling is exhausted.InvalidDataException– The input is corrupt, unsafe or conflicting.NotSupportedException– The input uses an unsupported format or extraction feature.IOException– The destination is occupied, contains links, or cannot be published.
public static ArchiveExtractionResult Extract(Stream source, string destinationDirectory, ArchiveExtractionOptions? options = null, string? sourceName = null, CancellationToken cancellationToken = default) #Extracts a bounded snapshot from the stream's current position through EOF, leaving it open. The operation admits input as it is copied, before the format is known. Supply a source name to name a standalone compressed file that carries no member name.
Parameters
- source System.IO.Stream
- destinationDirectory string
- options OfficeIMO.Archives.ArchiveExtractionOptions? = null
- sourceName string? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ArchiveExtractionResultpublic static ArchiveExtractionResult ExtractRar5Volumes(IReadOnlyList<string> volumePaths, string destinationDirectory, ArchiveExtractionOptions? options = null, CancellationToken cancellationToken = default) #Verifies and extracts a complete RAR5 set supplied in volume order. Publishes only after all selected stored members pass integrity and path checks. Archive links and ownership are not applied on disk.
Parameters
- volumePaths System.Collections.Generic.IReadOnlyList<string>
- destinationDirectory string
- options OfficeIMO.Archives.ArchiveExtractionOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ArchiveExtractionResult