848
edits
Line 3: | Line 3: | ||
== Header == | == Header == | ||
A ZIM file starts with a header. This is offset 0. | |||
A ZIM file starts with a header. This | |||
Length in byte, all types are littlendian. | Length in byte, all types are littlendian. | ||
Line 33: | Line 32: | ||
| layoutPage || integer || 68 || 4 || layout page or 0xffffffffff if no layout page | | layoutPage || integer || 68 || 4 || layout page or 0xffffffffff if no layout page | ||
|} | |} | ||
== MIME Type List (mimeListPos) == | == MIME Type List (mimeListPos) == | ||
Line 95: | Line 92: | ||
* accessing directory entries by title also makes use of cached directory entries which are referenced by the URL pointers, as implemented in zimlib. | * accessing directory entries by title also makes use of cached directory entries which are referenced by the URL pointers, as implemented in zimlib. | ||
== Directory | == Directory Entries == | ||
Directory entries hold the meta information about all articles, images and other objects in a ZIM file. | Directory entries hold the meta information about all articles, images and other objects in a ZIM file. | ||
There are | There are two types of directory entries: article entries and redirect entries. If the first two bytes are 0xffff the directory entry is a redirect. | ||
directory | |||
=== | === Article Entry === | ||
{|{{Prettytable}} | {|{{Prettytable}} | ||
! Field Name !! Type !! Offset !! Length !! Description | ! Field Name !! Type !!Offset!!Length!! Description | ||
|- | |- | ||
| | | mimetype || integer || 0 || 2 || MIME type number as defined in the MIME type list | ||
|- | |- | ||
| parameter len || || 2 || 1 || length of extra paramters | | parameter len || byte || 2 || 1 || (not used) length of extra paramters | ||
|- | |- | ||
| namespace || char || 3 || 1 || | | namespace || char || 3 || 1 || defines to which namespace this directory entry belongs | ||
|- | |- | ||
| | | revision || integer || 4 || 4 || (optional) identifies a revision of the contents of this directory entry, needed to identify updates or revisions in the original history | ||
|- | |- | ||
| cluster number || integer || 8 || 4 || | | cluster number || integer || 8 || 4 || cluster number in which the data of this directory entry is stored | ||
|- | |- | ||
| blob number || integer || 12 || 4 || | | blob number || integer || 12 || 4 || blob number inside the compressed cluster where the contents are stored | ||
|- | |- | ||
| url || string || 16 || zero terminated || string with the | | url || string || 16 ||zero terminated|| string with the URL as refered in the URL pointer list | ||
|- | |- | ||
| title || string || || zero terminated || string with title or empty; in case it is empty, the | | title || string || n/a ||zero terminated|| string with an title as refered in the Title pointer list or empty; in case it is empty, the URL is used as title | ||
|- | |- | ||
| parameter || data || ||see parameter len|| (not used) extra parameters | |||
|} | |} | ||
=== | === Redirect Entry === | ||
{|{{Prettytable}} | {|{{Prettytable}} | ||
! Field Name !! Type !! Offset !! Length !! Description | ! Field Name !! Type !!Offset!!Length!! Description | ||
|- | |- | ||
| | | mimetype || integer || 0 || 2 || 0xffff for redirect | ||
|- | |- | ||
| | | parameter len || byte || 2 || 1 || (not used) length of extra paramters | ||
|- | |- | ||
| | | namespace || char || 3 || 1 || defines to which namespace this directory entry belongs | ||
|- | |- | ||
| | | revision || integer || 4 || 4 || (optional) identifies a revision of the contents of this directory entry, needed to identify updates or revisions in the original history | ||
|- | |- | ||
| | | redirect index || integer || 8 || 4 || pointer to the directory entry of the redirect target | ||
|- | |- | ||
| | | url || string || 16 ||zero terminated|| string with the URL as refered in the URL pointer list | ||
|- | |- | ||
| | | title || string || n/a ||zero terminated|| string with an title as refered in the Title pointer list or empty; in case it is empty, the URL is used as title | ||
|- | |- | ||
| parameter || data || ||see parameter len|| (not used) extra parameters | |||
|} | |} | ||