Expand description
Safe Rust bindings for libarchive
This crate provides idiomatic Rust bindings to libarchive, supporting reading and writing various archive formats (tar, zip, 7z, etc.) with multiple compression formats.
§Examples
§Reading an archive
use libarchive2::ReadArchive;
// Reading from a file (lifetime is 'static)
let mut archive = ReadArchive::open("archive.tar.gz")?;
while let Some(entry) = archive.next_entry()? {
println!("File: {}", entry.pathname().unwrap_or_default());
// Read entry data...
}
§Writing an archive
use libarchive2::{WriteArchive, ArchiveFormat, CompressionFormat};
let mut archive = WriteArchive::new()
.format(ArchiveFormat::Tar)
.compression(CompressionFormat::Gzip)
.open_file("output.tar.gz")?;
archive.add_file("file.txt", b"Hello, world!")?;
Structs§
- AclEntry
- ACL entry
- AclPermissions
- ACL permission flags
- Archive
Match - Archive matcher for filtering entries based on patterns
- Callback
Reader - Builder for reading archives with custom Read implementations
- Callback
Writer - Builder for writing archives with custom Write implementations
- Compression
Level - Compression level (0-9)
- Entry
- Immutable reference to an archive entry
- Entry
Mut - Mutable reference to an archive entry for building/writing
- Extract
Flags - Flags for controlling extraction behavior
- Progress
Tracker - Progress tracker for monitoring archive operations
- Read
Archive - Archive reader with RAII resource management
- Read
Disk - Archive reader for reading files from disk
- Read
Disk Flags - Behavior flags for reading from disk
- Write
Archive - Archive writer with builder pattern and RAII resource management
- Write
Disk - Archive writer for extracting entries to disk
- Xattr
- Extended attribute (xattr)
Enums§
- AclTag
- ACL tag type
- AclType
- ACL entry type
- Archive
Format - Archive format types
- Compression
Format - Compression format types
- Error
- Error type for libarchive operations
- File
Type - File type of an archive entry
- Filter
Option - Filter-specific options for compression
- Format
Option - Format-specific options for archive writing
- Read
Format - Format specifier for reading archives
- Symlink
Mode - Symlink handling mode
- ZipCompression
Method - ZIP compression method options
Traits§
- Entry
AclExt - Extension trait for Entry to add ACL/xattr reading
- Entry
MutAcl Ext - Extension trait for EntryMut to add ACL/xattr manipulation
- Progress
Callback - Trait for progress tracking callbacks
Functions§
- version
- Returns the version string of the underlying libarchive library
- version_
details - Returns detailed version information including linked libraries
- version_
number - Returns the version number of the underlying libarchive library
Type Aliases§
- Result
- Result type for libarchive operations