pub struct AsarArchive { /* private fields */ }Expand description
An ASAR archive that can be read from or written to disk.
§Creating archives
use asar_rust::AsarArchive;
use std::path::Path;
let archive = AsarArchive::pack(Path::new("src"), Path::new("app.asar")).unwrap();§Reading archives
use asar_rust::AsarArchive;
use std::path::Path;
let archive = AsarArchive::open(Path::new("app.asar")).unwrap();
let files = archive.list().unwrap();
let data = archive.extract_file("main.js").unwrap();Implementations§
Source§impl AsarArchive
impl AsarArchive
Sourcepub fn pack(src: &Path, dest: &Path) -> Result<Self, AsarError>
pub fn pack(src: &Path, dest: &Path) -> Result<Self, AsarError>
Create a new ASAR archive from a directory.
Sourcepub fn pack_with_options(
src: &Path,
dest: &Path,
options: CreateOptions,
) -> Result<Self, AsarError>
pub fn pack_with_options( src: &Path, dest: &Path, options: CreateOptions, ) -> Result<Self, AsarError>
Create an ASAR archive with custom options.
Sourcepub fn open(archive_path: &Path) -> Result<Self, AsarError>
pub fn open(archive_path: &Path) -> Result<Self, AsarError>
Open an existing ASAR archive for reading.
Sourcepub fn raw_header(&self) -> Result<ArchiveHeader, AsarError>
pub fn raw_header(&self) -> Result<ArchiveHeader, AsarError>
Get the raw archive header.
Sourcepub fn list_with_flags(
&self,
opts: ListOptions,
) -> Result<Vec<String>, AsarError>
pub fn list_with_flags( &self, opts: ListOptions, ) -> Result<Vec<String>, AsarError>
List files with pack/unpack state.
Sourcepub fn stat(
&self,
filename: &str,
follow_links: bool,
) -> Result<FilesystemEntry, AsarError>
pub fn stat( &self, filename: &str, follow_links: bool, ) -> Result<FilesystemEntry, AsarError>
Get metadata for a file in the archive.
Auto Trait Implementations§
impl Freeze for AsarArchive
impl RefUnwindSafe for AsarArchive
impl Send for AsarArchive
impl Sync for AsarArchive
impl Unpin for AsarArchive
impl UnsafeUnpin for AsarArchive
impl UnwindSafe for AsarArchive
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more