The Fuchsia archive format is a format for storing a directory tree in a file. Like a
.zip file, a Fuchsia archive file stores a mapping from path names to file contents.
Fuchsia archive files are sometimes referred to as FARs or FAR archives, and are given the filename extension
An archive is a sequence of bytes, divided into chunks:
All offsets and lengths are encoded as unsigned integers in little endian.
The index chunk is required and must start at the beginning of the archive.
No two index entries can have the same type and the entries must be sorted by type in increasing lexicographical octet order (e.g., as compared by memcmp). The chunks listed in the index must be stored in the archive in the order listed in the index.
The directory chunk is required. Entries in the directory chunk must have unique names and the entries must be sorted by name in increasing lexicographical octet order (e.g., as compared by memcmp).
These entries represent the files contained in the archive. Directories themselves are not represented explicitly, which means archives cannot represent empty directories.
The directory names chunk is required and is used by the directory chunk to name the content chunks. Path data must be sorted in increasing lexicographical octet order (e.g., as compared by memcmp).
Note: The offsets used to index into the path data are 32 bits long, which means there is no reason to create a directory name chunk that is larger than 4 GB.
Although no encoding is specified, clients that wish to display path data using unicode may attempt to decode the data as UTF-8. The path data might or might not be UTF-8, which means that decoding might fail.
Content chunks must be after all the chunks listed in the index chunk. The content chunks must appear in the archive in the order they are listed in the directory.
The data must be aligned on a 4096 byte boundary from the start of the archive and the data must be padded with zeros until the next 4096 byte boundary.