aspose.info
EN

ZIM File Format - OpenZIM Archive File

Updated

What is a ZIM file?

Files with .zim extension are archives created to store Wiki content offline. It is considered as the most suitable open file format for storing Wikipedia on a USB. It stores site contents in a compact format. Its name comes from “Zeno IMproved” which was the earlier Zeno file format. ZIM is maintained by openZIM project which is sponsored by Wikimedia CH, and supported by the Wikimedia Foundation. ZIM files can be opened by applications such as Kiwix and ZIMReader. OpenZIM project has hosted the implementation of ZIM file format on Github for contribution from OpenSource community.

ZIM File Format Specifications

ZIM file format was developed on top of Zeno file format and is not backwards compatible. The format specifications of ZIM file format are available online by openZIM for developer’s reference. OpenZIM has provided C++ open source implementation, LibZim, for reading and writing ZIM files.

ZIM file format uses LZMA2 compression to make the content compact.

ZIM File Format

ZIM Header

A ZIM file starts with a header that is at offset 0. All the constituents are based on little-endian and all the integers are unsigned integers i.e. uint_16, uint_32, uint_64.

Field NameTypeOffsetLengthDescription
magicNumberinteger04Magic number to recognise the file format, must be 72173914 (0x44D495A)
majorVersioninteger42Major version of the ZIM file format (5 or 6)
minorVersioninteger62Minor version of the ZIM file format
uuidinteger816unique id of this zim file
articleCountinteger244total number of articles
clusterCountinteger284total number of clusters
urlPtrPosinteger328position of the directory pointerlist ordered by URL
titlePtrPosinteger408position of the directory pointerlist ordered by Title
clusterPtrPosinteger488position of the cluster pointer list
mimeListPosinteger568position of the MIME type list (also header size)
mainPageinteger644main page or 0xffffffff if no main page
layoutPageinteger684layout page or 0xffffffffff if no layout page
checksumPosinteger728pointer to the md5checksum of this file without the checksum itself. This points always 16 bytes before the end of the file.

References