GzipArchive.Extract

Extract(Stream)

Extracts the archive to the stream provided.

public void Extract(Stream destination)
ParameterTypeDescription
destinationStreamDestination stream. Must be writable.

Exceptions

exceptioncondition
ArgumentExceptiondestination does not support writing.
InvalidDataExceptionStream is corrupted and does not contain valid data.

Examples

using (var archive = new GzipArchive("archive.gz"))
{
     archive.Extract(httpResponseStream);
}

See Also


Extract(string)

Extracts the archive to the file by path.

public FileInfo Extract(string path)
ParameterTypeDescription
pathStringThe path to destination file. If the file already exists, it will be overwritten.

Return Value

Info of extracted file.

Exceptions

exceptioncondition
ArgumentNullExceptionpath is null.
SecurityExceptionThe caller does not have the required permission to access.
ArgumentExceptionThe path is empty, contains only white spaces, or contains invalid characters.
UnauthorizedAccessExceptionAccess to file path is denied.
PathTooLongExceptionThe specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
NotSupportedExceptionFile at path contains a colon (:) in the middle of the string.
InvalidDataExceptionStream is corrupted and does not contain valid data.

See Also