Im working on reading zip files over http using http ranges. To do that correctly I first fetch the last couple of bytes from archive to read the central directory following by reading the bytes for a specific file.
However, this library does not provide me with the exact number of bytes for a single file.
I can use something along the lines of:
let entry = reader.file().entries().get(0).unwrap();
let offset = entry.header_offset();
// Get the size of the entry plus the header + size of the filename. We should also actually
// include bytes for the extra fields but we don't have that information.
let size = entry.entry().compressed_size() + 30 + entry.entry().filename().as_bytes().len();
but the computation of the size is fairly magical and incorrect if the header contains extra fields.
What would be a "nicer" way to get this information? Would it be possible to add a function that returns the total size of the file in the archive from a StoredZipEntry?
Im working on reading zip files over http using http ranges. To do that correctly I first fetch the last couple of bytes from archive to read the central directory following by reading the bytes for a specific file.
However, this library does not provide me with the exact number of bytes for a single file.
I can use something along the lines of:
but the computation of the
size
is fairly magical and incorrect if the header contains extra fields.What would be a "nicer" way to get this information? Would it be possible to add a function that returns the total size of the file in the archive from a
StoredZipEntry
?