View Single Post
Old 09-12-2008, 09:34 AM   #5
salty-horse
Enthusiast
salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.salty-horse got an A in P-Chem.
 
salty-horse's Avatar
 
Posts: 27
Karma: 6166
Join Date: Sep 2008
Device: Sony PRS-T1
Info-Zip actually checks if the "deflate" algorithm will reduce the file size. In the case of the mimetype file, it's too small for the algorithm to be efficient, so no compression is done.

It also removes duplicates from the file list (such as the case of "mimetype *"), and zips the files by order.

All of those form a very nice trick.

HOWEVER (and I just figured this out), this creates a non-standard epub file.

The specification states:

http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm

Quote:
The [mimetype] file MUST be neither compressed nor encrypted and there MUST NOT be an extra field in its ZIP header.
By default, zip adds "extra file attributes". This prevent the text 'application/epub+zip' from being located in byte 38 in the epub file.

The original in my post used the -X flag on the mimetype. That flag strips away the headers, and is what required by the spec.

BTW, the commands were given to me by Hadrien Gardeur. I claim no credit.
salty-horse is offline   Reply With Quote