Expand description
An archive of “files”, either in a filesystem directory or zip archive.
The primary object of interest in this crate is the struct ZipDirArchive,
which provides a read-only wrapper over a directory within a filesystem or a
zip archive. The wrapper allows introspection of the archive and reading
contents. To write a zip archive, you may save contents to a directory and
then use the copy_archive_to_zipfile function. (Because any valid zip
archive should be supported by ZipDirArchive, as an alternative to using
this function to create a zip archive, you may create the zip file via any
other means.)
When reading zip archives, the zip file need not be a local file on the
filesystem. Instead, ZipDirArchive::from_zip takes any reader that
implements the std::io::Read + std::io::Seek traits. Therefore, one could
open files over e.g. HTTP using a reader that implements these traits.
http-range-client is one
such client, albeit untested.
The development use case was to implement the
.braidz
storage format for the Braid program. Braid
saves data during acquisition by streaming to .csv files (or compressed
.csv.gz files) but then, when finished, will copy these files from a plain
directory on disk into a .zip archive.
Zip archives may be created in a custom manner to allow features such as
having initial data in the file which identifies the file type as something
beyond a plain zip file and storing files in the zip archive without
compression from the zip container (e.g. because the original file is
already compressed). Both of these features are used in the .braidz
format.
Structs§
- File
Reader - Provides a single concrete type for a normal file or a zipped file.
- Path
Like - A representation of a path within the archive.
- ZipDir
Archive - Read-access to either a single zip file or an directory.
Enums§
- Error
- The possible error types.
- Maybe
GzReader - A file reader that transparently decodes gzip compression.
Functions§
- copy_
archive_ to_ zipfile - Copy
src, an already open archive, todest, an already open file. - copy_
to_ zip - Copy source
src(dir or zip) to a new zip atdest.
Type Aliases§
- Result
- A type alias to wrap return types.