View Single Post
Old 12-31-2009, 05:27 PM   #1
acts_as_david
Reader/Developer
acts_as_david began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Dec 2009
Device: Sony PRS-600
Post Zip spec for ePub

According to the ePub OCF spec, the ePub format should be zipped using the PK Zip compression method, as described in the PKware APPNOTE:

http://www.pkware.com/documents/casestudies/APPNOTE.TXT

The short version of my question: I'm looking for an easy, cross-platform way to accomplish this in a conversion tool I'm writing.

More specifically: I'm designing an ePub library (and tool) for Ruby to handle, manipulate, and create ePub files. Directory and file creation is easy enough, but Zipping them up into an ePub file gets tricky.

Right now, I'm using the following (on OS X, should work in Linux, too):

Code:
`zip -X0 Sample.epub mimetype`
`zip -rX9 Sample.epub * -x mimetype`
This is fine and produces a Zip file that looks something like this in my Hex editor:

PK...........;oa
.,............mi
metypeapplicatio
n/epub+zipPK...
......l.;......
..........META-I
NF/PK........%..
;.f......4......
.META-INF/contai
ner.xml

That is, mimetype and 'application/epub+zip' occur at the right offsets, according to the spec.

But no other Zip utility I've found will output this type of Zip file! Not in OS X ('compress') or Linux or Windows (Send to -> Archive). Trying rubyzip and zipruby didn't help. My files never turn out correct using these tools/libraries, and they don't pass epubcheck.

Any suggestions on what library I should use to Zip up my archives?

Last edited by acts_as_david; 12-31-2009 at 05:29 PM. Reason: fix code sections
acts_as_david is offline   Reply With Quote