libarchive reads and writes streaming archives and compression in many formats. It includes bsdtar, bsdcpio, bsdcat, and bsdunzip command-line programs built on the library.
Overview
libarchive is a portable, efficient C library for reading and writing streaming archives in a wide variety of formats. The same distribution ships command-line tools—bsdtar, bsdcpio, bsdcat, and bsdunzip—that exercise the library for everyday archive tasks.
On read, the library automatically detects archive and compression combinations, including layered cases such as tar.gz. Supported read formats span classic tar and cpio variants, zip and zipx, 7-Zip, ISO9660, ar, mtree, RAR with noted limitations, WARC, XAR, CAB, LHA, and more, plus preprocessors such as gzip, bzip2, xz, zstd, and lz4. Write support covers ustar, pax, cpio, zip, shar, ar, iso9660, 7z, warc, xar, and optional compression filters.
The design is stream-oriented for single-pass processing from files, pipes, sockets, or memory callbacks, which suits large archives or on-the-fly serving. Random access and in-place archive editing are not direct goals; transparent format handling uses one API across formats.
Manual pages document the tools and library APIs. The project reports use on POSIX-like systems including Linux and FreeBSD and support for Windows via Cygwin, MinGW, and Visual Studio. Static linking is structured so unused format or compression backends can stay out of binaries unless enabled.
Key features
- Read and write many archive formats
- Automatic format and compression detection
- Streaming single-pass archive I/O
- Callback-based read and write APIs
- bsdtar, bsdcpio, bsdcat, bsdunzip utilities
- Optional minimal static link footprint
- zip, 7z, tar, cpio, iso, and rar support
- Transparent multi-format API
Use cases
- Backup and packaging pipelines
- Programmatic archive read/write in C
- Replacing tar, cpio, or unzip CLI workflows
- Streaming archives over network or tape
- Format conversion via bsdtar