TAR libraries for C#
- System.Formats.Tar is part of .NET 7 and later. It reads ustar, pax, GNU and v7 archives, writes all 4, keeps Unix permissions and owners, and has one-line
TarFile.CreateFromDirectory/ExtractToDirectoryhelpers. For.tar.gzwrap the stream inGZipStream; there is no built-in xz or zstd. - SharpCompress reads and writes tar with gzip, bzip2 and lzip compression, and reads
.tar.xzand.tar.zsttoo. It also handles ZIP, 7z and RAR (read) through the same API, and runs on .NET Framework 4.8 and .NET Standard 2.0.
Use System.Formats.Tar on .NET 7+ when you need .tar or .tar.gz. Use SharpCompress for .tar.xz / .tar.zst, for older .NET, or when the same code must open other archive formats.
- SharpCompress SharpCompress is a pure C# library for TAR, .tar.gz, .tar.bz2, .tar.xz and .tar.zst. How to list, extract and create tar archives in .NET, with code examples.
- System.Formats.Tar System.Formats.Tar is the .NET 7+ built-in TAR library. How to create and extract .tar and .tar.gz files, list entries and write pax entries from memory in C#.