Fork me on GitHub

File structure

Underneath, Alfred stores each Key Map on an append-only file.

The file is homogeneous, i.e., each document is written one after the other.

Document header

On a file, each document starts with a header with 14 bytes.

The first two bytes are UTF-invalid magic tracker (0xDC80). It can be used, in case there is a corruption detected, to trace the start of the next document.

The remaining four bytes have the length of the document (ASCII).

Document trailer

Each document ends with a 40 byte trailer.

It starts with a 12-byte ASCII-encoded length.

Then comes a CRC32 checksum of the document.

In between, the document is serialized in JSON serialized form.