All formats

TAR libraries

Open-source libraries that read and write TAR archives. Many languages have TAR in the standard library (Go, Python, .NET, PHP’s Phar extension). TAR libraries handle only the archive layer: for .tar.gz you wrap the file stream in a gzip stream (often from the standard library too), and for .tar.xz or .tar.zst you may need an extra package.

Language Library Read Write Notes
C/C++ libarchive yes yes every tar variant and compressor, the engine of bsdtar
C/C++ microtar yes yes 2 files, MIT, basic headers only, unmaintained
C# System.Formats.Tar yes yes built into .NET 7+, pax/GNU/ustar/v7
C# SharpCompress yes yes also .tar.gz, .tar.bz2, .tar.xz, .tar.zst (read)
Java Apache Commons Compress yes yes streams and random access, pax and GNU
Go archive/tar yes yes standard library, pax/GNU/ustar
Python tarfile yes yes standard library, gzip/bz2/xz/zstd built in
Ruby minitar yes yes pure Ruby, ustar and GNU long names, no pax
Rust tar yes yes streaming, pure Rust, used by cargo
PHP PharData yes yes bundled with PHP, also gzip/bzip2
PHP php-archive yes yes pure PHP, streaming, low memory

By language#