南京市网站建设_网站建设公司_产品经理_seo优化
2026/1/21 9:04:24 网站建设 项目流程

 

Packing an EPUB file is more specific than just creating a ZIP archive. Because EPUB is a standard, it has a strict internal structure and a specific "first-file" rule that must be followed for the file to be valid. 

Here is how to pack your EPUB manually or using tools.


1. The "Magic" Rules for EPUB

To pass validation, your EPUB must meet these three conditions:

  • The mimetype file must be first: It must be the very first file in the ZIP archive.

  • No compression on mimetype: The mimetype file must be stored (0% compression), while everything else can be compressed.

  • No extra fields: The mimetype file cannot have any extra ZIP headers or "hidden" metadata.


2. Using Command Line

This is the most reliable way to ensure the mimetype is handled correctly. Open your terminal/command prompt inside your book's root folder.

On macOS / Linux

Run these two commands in order:

  1. Pack the mimetype (uncompressed):

    zip -0Xq mybook.epub mimetype

  2. Pack everything else (compressed):

    zip -9rXq mybook.epub * -x mimetype

(Note: -0 means no compression; -X excludes extra file attributes like .DS_Store.)

 
 

 

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询