This section covers the Honzo binary format at the byte level. You do not need this information to use Honzo. You need it to implement a parser or builder in a language without one.

File Layout

A Honzo file has six sections in sequence:

Offset  Section    Size        Description
------  -------    ----        -----------
0       HEAD       48          File header with magic, version, counts, and offsets
52      TOC        32 x N      Table of contents where N equals chunk_count
52+N*32 DATA       variable    Chunk payload data
        EXTRA      variable    Extra entries for extensible metadata
        META       variable    Book metadata encoded as MessagePack

Key Design Decisions

Fixed Size Entries

HEAD and TOC entries are fixed size. Parse by pointer cast. No allocation.

Absolute Offsets

Every section header contains absolute byte offsets. Seek and read without scanning.

META Is Last

Append only metadata edits. Edit the title without touching a single byte of content.

EXTRA Between DATA and META

Extensible entries for annotations, DRM, and sync. Preserves append semantics.

Byte Order

All multi byte integers are little endian. This matches x86, ARM, and WASM.

Pages in This Section