New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API for reading raw file content #205
Comments
Ah, another consequence of my clumsy use of There are a few issues like this (#198) that shouldn't take much work to resolve, so I'm making 0.5.9 a priority. |
I'm looping #209 (comment) back into this issue, since the changes seem closely linked. Would you be able to explain what you are reading the raw content of the files for? It'd be good to know what the API needs to give access to. impl<R: Read + io::Seek> ZipArchive<R> {
// Attempt to read the content of the file without decompressing it
pub fn by_index_raw<'a>(&'a mut self, file_number: usize) -> ZipResult<ZipFile<'a>>;
} And if you don't mind, it'd be great to know if this API works well for you: // This `File` type is from the next version of the crate
impl<R: io::Read> File<R> {
fn raw_reader(&mut self) -> &mut R;
}
// Copy any bzip2-compressed files out of the archive
Archive::open(File::open("compressed.zip")?)?
.iter()
.filter(|file| file.compression_method() == CompressionMethod::BZip2)
.map(|file| std::io::copy(file.raw_reader(), &mut File::create(file.name().to_pathbuf())?))
.collect::<Result<_, _>>()?; |
This is implemented as the |
Hi all.
I'm using zip-rs to only read zip archives (i.e. not decompress the content), and thus have default-features = false.
However the two variants of the enum CompressionMethod, Deflated and Bzip2 only exist if respectively the two features "flate" and "bzip2" are turned on. Currently this is not a big problem if you want to know the compression method, since you can just match on the Unsupported(v) variant and check the value v, however I can see that you are deprecating this variant.
So what am I suppose to do if I want to know the compression method but not turn on the decompression/compression features? Second is there a good reason for the variants Deflated and Bzip2 to be behind a feature flag?
Otherwise thanks for a really useful and easy to use crate :)
Nicklas
The text was updated successfully, but these errors were encountered: