# ArchiveExtractor

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

Class 

`OfficeIMO.Archives`

**Namespace**

`OfficeIMO.Archives`

**Assembly**

`OfficeIMO.Archives`

**Source revision**

`273d35d5ba8a` with working tree changes

**Source**

[ArchiveExtractor.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Archives/ArchiveExtractor.cs#L20)

**Modifiers**

static

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

## Inheritance

- object
- ArchiveExtractor

Filter members 

Show inherited

## Methods

Extract 2 overloads

`public static ArchiveExtractionResult Extract(string packagePath, string destinationDirectory, ArchiveExtractionOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-extract-string-string-officeimo-archives-archiveextractionoptions-threading-cancellationtoken)

[ArchiveExtractor.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Archives/ArchiveExtractor.cs#L20)

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**

Returns

`ArchiveExtractionResult`

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)` [#](#method-extract-io-stream-string-officeimo-archives-archiveextractionoptions-string-threading-cancellationtoken)

[ArchiveExtractor.cs:34](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Archives/ArchiveExtractor.cs#L34)

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**

Returns

`ArchiveExtractionResult`

`public static ArchiveExtractionResult ExtractRar5Volumes(IReadOnlyList<string> volumePaths, string destinationDirectory, ArchiveExtractionOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-extractrar5volumes-collections-generic-ireadonlylist-system-string-string-officeimo-archives-archiveextractionoptions-threading-cancellationtoken)

[ArchiveExtractor.Rar5.cs:10](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Archives/ArchiveExtractor.Rar5.cs#L10)

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**

Returns

`ArchiveExtractionResult`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:75F6EAB84C219B6A6CAC9A1FA9DD12290E1A7BE3403A3C67F90962C10BD76F62 -->
