View Single Post
Old 08-20-2016, 12:29 AM   #104
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by pdurrant View Post
You need to use two zip commands. One to add the mimetype, uncompressed, and then one to add the other files.

zip -X0 <quoted form of ePubFilePath> mimetype
zip -rDX9 <quoted form of ePubFilePath> * -x "*.DS_Store" -x mimetype
In practice, that's completely unnecessary on OS X. The following produces identical results:

Code:
zip -Xr9D /path/to/filename.epub mimetype * -x .DS_Store
If you dig through OS X's zip source code (it is open source), you'll see that unless you either A. pass the -Z flag to force a particular compression method or B. pass the -0 flag to disable compression entirely, the OS X zip tool defaults to "BEST" mode, which means that it uses either STORE (uncompressed) or DEFLATE (compressed), depending on which would produce a smaller file.

Because the mimetype file's contents are so short, it gets larger when compressed with DEFLATE. Therefore, OS X's zip implementation will always store it using STORE rather than DEFLATE.

Your mileage may vary with other zip implementations.
dgatwood is offline   Reply With Quote