pub struct PakFile { /* private fields */ }Expand description
Represents a PAK file by filepath and PakManifest Provides methods to iterate over file contents.
Implementations§
Source§impl PakFile
impl PakFile
pub fn new(filepath: PathBuf, manifest: PakManifest) -> Self
Sourcepub async fn from_file<P>(filepath: P) -> Result<Self>
pub async fn from_file<P>(filepath: P) -> Result<Self>
Constructs from a PAK file. Throws Error::OpenPak, Error::ReadPak
Sourcepub fn from_file_sync<P>(filepath: P) -> Result<Self>
pub fn from_file_sync<P>(filepath: P) -> Result<Self>
Constructs from a PAK file. Throws Error::OpenPak, Error::ReadPak
Sourcepub async fn create_from_dir<P>(
input_dir: P,
manifest: PakManifest,
output_filepath: P,
) -> Result<Self>
pub async fn create_from_dir<P>( input_dir: P, manifest: PakManifest, output_filepath: P, ) -> Result<Self>
Creates a PAK file by copying files from a directory. The manifest for the directory must already have been generated using PakManifest::from_dir.
Sourcepub fn create_from_dir_sync<P>(
input_dir: P,
manifest: PakManifest,
output_filepath: P,
) -> Result<Self>
pub fn create_from_dir_sync<P>( input_dir: P, manifest: PakManifest, output_filepath: P, ) -> Result<Self>
Creates (writes) a PAK file by copying files from a directory. The manifest for the directory must already have been generated using PakManifest::from_dir_sync.
Sourcepub fn extract_sync<P: AsRef<Path>>(&self, dest_dir: P) -> Result<()>
pub fn extract_sync<P: AsRef<Path>>(&self, dest_dir: P) -> Result<()>
Extracts the contents of the PAK file to the specified directory. Throws Error::CreateDirectory, Error::OpenPak, Error::WritePak
Sourcepub async fn extract<P: AsRef<Path>>(&self, dest_dir: P) -> Result<()>
pub async fn extract<P: AsRef<Path>>(&self, dest_dir: P) -> Result<()>
Extracts the contents of the PAK file to the specified directory. Throws Error::CreateDirectory, Error::OpenPak, Error::WritePak
Sourcepub fn read_items<'p>(&'p self) -> impl Stream<Item = Result<PakItem<'p>>>
pub fn read_items<'p>(&'p self) -> impl Stream<Item = Result<PakItem<'p>>>
Returns an iterator over each file item in the PAK, including data. Throws Error::OpenPak, Error::ReadPak
Sourcepub fn read_items_sync<'p>(
&'p self,
) -> Result<impl Iterator<Item = Result<PakItem<'p>>>>
pub fn read_items_sync<'p>( &'p self, ) -> Result<impl Iterator<Item = Result<PakItem<'p>>>>
Returns an iterator over each file item in the PAK, including data. Throws Error::OpenPak, Error::ReadPak