'Error GZIP header, first magic byte doesn’t match - How to Decompressing .tar.gz file using SharpZipLib

I’m trying to decompress a compress file with multiple files on it

the following code works to .tgz files, but don’t for .tar.gz files

What is wrong here?

FileInfo infoCompressed = new FileInfo(compressedFilePath);
DirectoryInfo destinyDir = new DirectoryInfo(infoCompressed.Directory.ToString());

if (!destinyDir.Exists)
     destinyDir.Create();

using(Stream originFile = new GZipInputStream(infoCompressed.OpenRead()))
{
     using(TarArchive tarFile = TarArchive.CreateInputTarArchive(originFile, TarBuffer.DefaultBlockFactor, Encoding.Default))
     {
          tarFile.ExtractContents(destinyDir.FullName);
     }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source