Search code examples
c#tarbzip2gzip

Unpacking tar/BZ2 files using C#


I have a tar.bz2 file and I want to extract it to a directory. In the examples I only see option of compress or decompress however I want actually to extract or unpack.

Also tried ICSharpCode.SharpZipLib.BZip2 but I didn't find an option to unpack.


Solution

  • While you use a ZipInputStream for .zip files, you should use a BZip2InputStream for .bz2 files (and GZipInputStream for .gz files etc.).

    Taken from:

    How to decompress .bz2 file in C#?