pub struct Archive { /* private fields */ }Implementations§
Source§impl Archive
impl Archive
Sourcepub fn new(file: File) -> Self
pub fn new(file: File) -> Self
Creates a new archive file. The file signature is written to the beginning of the file. The file is truncated to 0 bytes.
Sourcepub fn open(path: &str) -> Result<Self, Error>
pub fn open(path: &str) -> Result<Self, Error>
Opens an existing archive file for reading and writing. This will not overwrite the file, but append to it.
Sourcepub fn add_directory(
&mut self,
path: &str,
progress: Option<fn(&PathBuf)>,
) -> Result<(), Error>
pub fn add_directory( &mut self, path: &str, progress: Option<fn(&PathBuf)>, ) -> Result<(), Error>
Adds all files in the given directory to the archive. (including subdirectories) This will append the directory to the end of the archive, if this directory already exists, it will not be replaced.
After this function is called, the existing header will be trimmed to the end of the archive, then readded upon completion.
§Panics
This function will panic if any filename is not valid UTF-8 or longer than 255 bytes.
Sourcepub fn into_entries(self) -> Vec<Entry>
pub fn into_entries(self) -> Vec<Entry>
Consumes the archive and returns the entries.
Sourcepub fn add_entry(
&mut self,
entry: DirEntry,
progress: Option<fn(&PathBuf)>,
) -> Result<(), Error>
pub fn add_entry( &mut self, entry: DirEntry, progress: Option<fn(&PathBuf)>, ) -> Result<(), Error>
Adds a single file entry to the archive. (including subdirectories) This will append the entry to the end of the archive, if this entry already exists, it will not be replaced.
After this function is called, the existing header will be trimmed to the end of the archive, then readded upon completion.
§Panics
This function will panic if any filename is not valid UTF-8 or longer than 255 bytes.