ZipFileSystem should expose more metadata
swankjesse opened this issue · comments
We should expose stuff from ZipEntry in the ZipFileSystem’s FileMetadata, using the extras
field.
For example, we could include any of the following:
/** The comment on this entry. Empty if there is no comment. */
val comment: String = ""
/** The CRC32 of the uncompressed data, or -1 if not set. */
val crc: Long = -1L
/** The compressed size in bytes, or -1 if unknown. */
val compressedSize: Long = -1L
/** Either [COMPRESSION_METHOD_DEFLATED] or [COMPRESSION_METHOD_STORED]. */
val compressionMethod: Int = -1
I selfishly would like to see the amount of bytes the file requires in the actual zip format. That is, to say, summing the format size of each file should produce a total that is equal to the size of the whole .zip (less the central directory header and trailer).
Here's what I'm doing now: https://github.com/JakeWharton/diffuse/blob/trunk/io/src/main/kotlin/com/jakewharton/diffuse/io/Zip.kt#L71-L107
I would be happy if this was a derived value, just more plainly derived. Such as original size, stored size, and metadata size (where what I want is stored + metadata).