pub struct Archive {
pub blocks: Vec<Block>,
pub files: Vec<ArchiveEntry>,
pub stream_map: StreamMap,
pub is_solid: bool,
/* private fields */
}Expand description
Represents a parsed 7z archive structure.
Contains metadata about the archive including files, compression blocks, and internal structure information necessary for decompression.
Fields§
§blocks: Vec<Block>Compression blocks in the archive.
files: Vec<ArchiveEntry>File and directory entries in the archive.
stream_map: StreamMapMapping between files, blocks, and pack streams.
is_solid: boolWhether this is a solid archive (better compression, slower random access).
Implementations§
Source§impl Archive
impl Archive
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Archive, Error>
pub fn open(path: impl AsRef<Path>) -> Result<Archive, Error>
Open 7z file under specified path.
Sourcepub fn open_with_password(
path: impl AsRef<Path>,
password: &Password,
) -> Result<Archive, Error>
pub fn open_with_password( path: impl AsRef<Path>, password: &Password, ) -> Result<Archive, Error>
Open an encrypted 7z file under specified path with password.
§Parameters
reader- the path to the 7z filepassword- archive password encoded in utf16 little endian
Sourcepub fn read<R: Read + Seek>(
reader: &mut R,
password: &Password,
) -> Result<Archive, Error>
pub fn read<R: Read + Seek>( reader: &mut R, password: &Password, ) -> Result<Archive, Error>
Read 7z file archive info use the specified reader.
§Parameters
reader- the reader of the 7z filr archivepassword- archive password encoded in utf16 little endian
§Example
use std::{
fs::File,
io::{Read, Seek},
};
use sevenz_rust2::*;
let mut reader = File::open("example.7z").unwrap();
let password = Password::from("the password");
let archive = Archive::read(&mut reader, &password).unwrap();
for entry in &archive.files {
println!("{}", entry.name());
}Source§impl Archive
impl Archive
Sourcepub fn pack_pos(&self) -> u64
pub fn pack_pos(&self) -> u64
Returns the offset from beginning of file + SIGNATURE_HEADER_SIZE to packed streams. Used for calculating byte offsets when streaming uncompressed (COPY) content.
Sourcepub fn pack_sizes(&self) -> &[u64]
pub fn pack_sizes(&self) -> &[u64]
Returns the sizes of each packed stream in bytes. Used for calculating byte ranges when streaming.