Skip to content

How to add mimetype file as first file of the archive #81

@RamiroPastor

Description

@RamiroPastor

Hi, I've started using this package to create a .epub file and I must say it has been much smoother than the javascript library I tried previously (epub-zipper)

However, there is one small detail I cannot solve: the EPUB 3.2 specification states that

The first file in the OCF ZIP Container MUST be the mimetype file

And that it must not be compressed. I have achieved the "non-compressed" condition, but i don't know how to fulfill the "first file in the zip archive" condition. This is my code:

main :: IO ()
main = do
  mimetype <- mkEntrySelector "mimetype"
  createArchive "conmocion.epub" $ do
    packDirRecur Deflate (\s -> mkEntrySelector $ "META-INF/" ++ s) "./ePub/META-INF"
    packDirRecur Deflate (\s -> mkEntrySelector $ "es/" ++ s)       "./ePub/es"
    loadEntry    Store mimetype "./ePub/mimetype"

And I get the following error in the epub online validator

Mimetype file entry is missing or is not the first file in the archive.

Any idea on how to put the mimetype file as the first file in the archive?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions