pub struct ZipDirArchive<R: Read + Seek> { /* private fields */ }Expand description
Read-access to either a single zip file or an directory.
This provides a uniform API for accessing files in a directory in a conventional filesystem or accessing entries in a zip archive. See the crate-level documentation for more information.
Implementations§
Source§impl ZipDirArchive<BufReader<File>>
impl ZipDirArchive<BufReader<File>>
Sourcepub fn auto_from_path<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn auto_from_path<P: AsRef<Path>>(path: P) -> Result<Self>
Automatically open a path on the filesystem as a ZipDirArchive
If the path is a directory, it will be opened with Self::from_dir. If not, it will be opened as a file and passed to Self::from_zip.
Source§impl<R: Read + Seek> ZipDirArchive<R>
impl<R: Read + Seek> ZipDirArchive<R>
Sourcepub fn from_zip(reader: R, display_name: String) -> Result<Self>
pub fn from_zip(reader: R, display_name: String) -> Result<Self>
Open a reader of a zip archive as a ZipDirArchive.
pub fn path_starter(&mut self) -> PathLike<'_, R>
pub fn display(&self) -> Display<'_>
pub fn path(&self) -> &Path
pub fn exists(&mut self, relname: &Path) -> bool
Sourcepub fn open<P: AsRef<Path>>(&mut self, relname: P) -> Result<FileReader<'_>>
pub fn open<P: AsRef<Path>>(&mut self, relname: P) -> Result<FileReader<'_>>
Open relative path and return reader.
pub fn is_file<P: AsRef<Path>>(&mut self, relname: P) -> bool
Sourcepub fn list_paths<P: AsRef<Path> + Debug>(
&self,
relname: Option<P>,
) -> Result<Vec<PathBuf>>
pub fn list_paths<P: AsRef<Path> + Debug>( &self, relname: Option<P>, ) -> Result<Vec<PathBuf>>
Lists, non-recursively, the paths in this directory.
Note that on Windows, the result paths will have backslashes even though the zip file itself will have paths with forward slashes.
Sourcepub fn open_raw_or_gz(&mut self, src_fname: &str) -> Result<MaybeGzReader<'_>>
pub fn open_raw_or_gz(&mut self, src_fname: &str) -> Result<MaybeGzReader<'_>>
Open raw file (e.g. .csv) or gz version (e.g. .csv.gz) of a file.
This prefers to use the gz compressed file if it exists.