Xceed .NET Libraries Documentation
Extracting from a gzip file

Welcome to Xceed .NET, .NET Standard and Xamarin Libraries! > Basic Concepts > Tar and GZip capabilities > Xceed GZip > Extracting from a gzip file

This topic demonstrates how to extract a file from a GZip archive to a destination folder. With Xceed’s FileSystem-based products, a file is a file: it does not matter if it is located on disk or in memory, etc.

FileSystem-based GZip is not currently available in Xceed's .NET Compact Framework products.

Basic steps

To extract items from a GZip archive, the following steps must be performed:

Demonstration

This example demonstrates how to extract a GZipped file from a GZip archive to a folder located on disk.

VB.NET Copy Code

Imports Xceed.GZip
Imports Xceed.FileSystem   

Dim gzip As New GZipArchive( New DiskFile( "c:\test.gz" ) )
Dim folder As New DiskFolder( "c:\temp" )

gzip.CopyFilesTo( folder, true, true )

C# Copy Code

using Xceed.GZip;
using Xceed.FileSystem;

GZipArchive gzip = new GZipArchive( new DiskFile( @"c:\test.gz" ) );
DiskFolder folder = new DiskFolder( @"c:\temp" );

gzip.CopyFilesTo( folder, true, true );

Things you should consider

The main questions you should ask yourself when extracting items from a GZip archive are: