Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

ZipArchive.ExtractFileAsync Method

Namespace: Rebex.IO.Compression
Assembly: Rebex.Zip.dll (version 7.0.9147)

ExtractFileAsync(String, String, Object)

Begins asynchronous ExtractFile operation. Extracts the specified archive file item into a local file.

Declaration
public Task<ArchiveOperationResult> ExtractFileAsync(string archiveFilePath, string targetPath, object state = null)
Parameters
Type Name Description
String archiveFilePath

Path to an archive file to be extracted.

String targetPath

Path to a (non-existing) local file or path to a directory ending with directory separator (typically '&apos;).

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task<ArchiveOperationResult>

Operation result.

Exceptions
Type Condition
ArgumentNullException

The specified path is null.

ArgumentException

The specified path is empty or contains invalid characters. -or- The system could not retrieve the absolute path.

InvalidOperationException

The specified path is not a file.

ObjectDisposedException

Archive was already disposed.

NotSupportedException

Path is in an invalid format.

PathTooLongException

targetPath exceed the maximum length defined by system.

DirectoryNotFoundException

Part of the target path was not found.

SecurityException

The caller does not have the required permissions.

UnauthorizedAccessException

Access to the file is denied.

IOException

Local file already exists or an I/O error occurred.

ZipException

Cannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information).

ExtractFileAsync(String, String, ActionOnExistingFiles, Object)

Begins asynchronous ExtractFile operation. Extracts the specified archive file item into a local file.

Declaration
public Task<ArchiveOperationResult> ExtractFileAsync(string archiveFilePath, string targetPath, ActionOnExistingFiles defaultActionOnExistingFiles, object state = null)
Parameters
Type Name Description
String archiveFilePath

Path to an archive file to be extracted.

String targetPath

Path to a (non-existing) local file or path to a directory ending with directory separator (typically '&apos;).

ActionOnExistingFiles defaultActionOnExistingFiles

Specifies the default behavior for files that already exists in the local directory.

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task<ArchiveOperationResult>

Operation result.

Exceptions
Type Condition
ArgumentNullException

The specified path is null.

ArgumentException

The specified path is empty or contains invalid characters. -or- The system could not retrieve the absolute path.

InvalidOperationException

The specified path is not a file.

ObjectDisposedException

Archive was already disposed.

NotSupportedException

Path is in an invalid format.

PathTooLongException

targetPath exceed the maximum length defined by system.

DirectoryNotFoundException

Part of the target path was not found.

SecurityException

The caller does not have the required permissions.

UnauthorizedAccessException

Access to the file is denied.

IOException

An I/O error occurred.

ZipException

Cannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information).

ExtractFileAsync(String, Stream, Object)

Begins asynchronous ExtractFile operation. Extracts the specified archive file item into a stream.

Declaration
public Task<ArchiveOperationResult> ExtractFileAsync(string archiveFilePath, Stream outputStream, object state = null)
Parameters
Type Name Description
String archiveFilePath

Path to an archive file to be extracted.

Stream outputStream

Stream to write the extracted data to.

Object state

An optional user-provided object that identifies this particular asynchronous operation.

Returns
Type Description
Task<ArchiveOperationResult>

Operation result.

Remarks

Note that data will be written to the current output stream position.

Exceptions
Type Condition
ArgumentNullException

The specified path or output stream is null.

ArgumentException

The specified path is empty.

InvalidOperationException

The output stream is not writable. -or- The specified path is not a file.

ObjectDisposedException

Archive was already disposed.

IOException

An I/O error occurred.

ZipException

Cannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information).

In This Article
  • ExtractFileAsync(String, String, Object)
  • ExtractFileAsync(String, String, ActionOnExistingFiles, Object)
  • ExtractFileAsync(String, Stream, Object)
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies