BArch File Format


All numbers are encoded in ASCII decimal, unless another base is specified, terminated by either a colon (':') or a NUL byte.

A BArch file contains a stream of records. Each record contains the following parts:

  1. The constant string "=BArch3\n" (in hex: 3d 42 41 72 63 68 33 0a)
  2. A single byte identifying the record type
  3. The path, followed by a NUL byte
  4. The metadata string, followed by a NUL byte
  5. A series of data chunks composed of:
    1. The record content length (L), followed by a colon
    2. L bytes of content data
    3. A zero-byte chunk
    4. CRC64 checksum on the data starting at the record type byte and ending at the last byte of the data
    5. Optional NUL padding: enough NUL bytes to pad the record out to a multiple of blocksize bytes if the blocksize is non-zero (defaults to zero).

    Record type Symbol Metadata Description Content Description
    Start-of-archive ^ A series of parameters separated by "&". The name and value in a parameter are seperated by "=" and the contents are URL-encoded. A list of the paths used to build the archive, each terminated with a NUL byte, prefixed with either a '+' (included paths), or a '-' (excluded paths). This will eventually be used to determine which paths to extract could be in the archive before scanning the archive, to reduce search overheads.
    Directory d Standard file metadata A list of all the files in the directory, each terminated with a NUL byte
    File f Standard file metadata The raw contents of the file
    Incremental File i Standard file metadata Undetermined
    Block Device b Standard file metadata The major and minor numbers, in hexadecimal, separated by a comma
    Character Device c Standard file metadata The major and minor numbers, in hexadecimal, separated by a comma
    Hard Link h None The path being linked to
    Symbolic Link l None The path being linked to
    Named Pipe p Standard file metadata None
    Named Socket s Standard file metadata None
    End-of-archive # None None

    Standard File metadata

    The standard file metadata is composed of a series of tagged values seperated by colons:

    s
    File size (distinct from data size).
    p
    UNIX file mode, in octal
    c
    Change time
    m
    Modification time
    o
    Owner ID number
    g
    Group ID number
    O
    Owner name
    G
    Group name
    Times are represented as the number of seconds since the UNIX epoch (midnight GMT January 1, 1970).

    Prefix Record Parameters

    The following parameters are written in the prefix record to identify parameters detailing how the archive was created for the extractor:

    incremental
    Has non-zero value if the archive was created with incremental mode turned on, zero otherwise.