![]() ![]() The last modification time of the file, no other time is saved, format see above The method the data was compressed with - for this purpose, 0x0000 is used, meaning "uncompressed" Options as to how to read this file - for this purpose, I use 0x0800, meaning UFT-8 encoded filename and comments and nothing else The host system and compatibility version - for this purpose, I just use 0x000A indicating Windows/NTFS but it really doesn't matter that much ![]() NameĪ file entry signature consisting of " PK" followed by the bytes 03 and 04 File entries are stacked one after another. In PHP, this is the hash algorithm with name " crc32b".Ī file entry is a part describing a file and containing its data. CRC-32 - A 4 byte CRC-32 checksum over the file data using the magical number 0xdebb20e3.DateTime - A timestamp with two second accuracy, bit format YYYYYYYmmmmddddd HHHHHiiiiiisssss in little endian byte order, e.g.UInt32 - A 4 byte, 32 bit number in little endian byte order (e.g.UInt16 - A 2 byte, 16 bit number in little endian byte order (e.g.This is a ZIP file containing an uncompressed text file " test.txt" containing the text "The quick brown fox jumps over the lazy dog." I colored the regions from above and each value and included a summary of each value's meaning: In detail, let's dive into to some bytes. The basic structure of a ZIP archive makes it easy to just assemble it on-the-fly: File Entry 1 Backgroundįor this purpose, it's enough to regard the minimum necessary structure of a ZIP archive: We won't need multi-part files and we won't need extra information stored for each file - and of course, we don't need any knowledge of compression algorithms. So I came up with the idea to just create an uncompressed ZIP archive on-the-fly around the raw data - and as I found out, this is quite easy. In my case, this could result in large temporary files which (as being mostly images) couldn't be compressed anyway. When I was trying to implement a "download directory" function into my custom web application, all solutions I could find were based on creating the zip file first and then sending it.
0 Comments
Leave a Reply. |