How to extract specific file (or have streamed access) from tar.gz (tar files and folders and then gzipped) using SharpZipLib? Or maybe anyone has some similar library to do that in .NET cf 3.5?
using ( FileStream inputStream = File.OpenRead ( aPackage ) )
{
using ( GzipInputStream gzStream = new GzipInputStream ( inputStream ) )
{
using ( TarInputStream tarStream = new TarInputStream ( gzStream ) )
{
TarEntry entry = tarStream.GetNextEntry();
while ( entry != null )
{
if ( entry == theOneIWant )
{
tarStream.CopyEntryContents (outputStream );
break;
}
entry = tarStream.GetNextEntry();
}
}
}
}