Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ArchiveExtractor

OfficeIMO.Archives

Namespace
OfficeIMO.Archives
Assembly
OfficeIMO.Archives
Source revision
273d35d5ba8a with working tree changes
Modifiers
static

Extracts one managed archive container into a fresh directory without executing its contents.

Inheritance

  • object
  • ArchiveExtractor

Methods

Extract 2 overloads
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 required
destinationDirectory string required
options OfficeIMO.Archives.ArchiveExtractionOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Exceptions

  • 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 required
destinationDirectory string required
options OfficeIMO.Archives.ArchiveExtractionOptions? = null optional
sourceName string? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public 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> required
destinationDirectory string required
options OfficeIMO.Archives.ArchiveExtractionOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional