XAR (short for ''eXtensible ARchive format'') is an
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
file archiver
A file archiver is a computer program that combines a number of files together into one archive file, or a series of archive files, for easier transportation or storage. File archivers may employ lossless data compression in their archive formats ...
and the archiver’s
file format
A file format is a standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary or free.
Some file formats ...
. It was created within the
OpenDarwin
Darwin is an open-source Unix operating system first released by Apple Inc. in 2000. It is composed of code derived from NeXTSTEP, BSD, Mach, and other free software projects' code, as well as code developed by Apple.
Darwin forms the Unix ...
project and is used in
macOS
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
X 10.5 and up for software installation routines, as well as browser extensions in
Safari
A safari (; ) is an overland journey to observe wild animals, especially in eastern or southern Africa. The so-called "Big Five" game animals of Africa – lion, leopard, rhinoceros, elephant, and Cape buffalo – particularly form an importa ...
5.0 and up. Xar replaced the use of
gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and in ...
ped
pax files.
[Nabble – xar in Mac OS X](_blank)
One
development branch of
RPM
Revolutions per minute (abbreviated rpm, RPM, rev/min, r/min, or with the notation min−1) is a unit of rotational speed or rotational frequency for rotating machines.
Standards
ISO 80000-3:2019 defines a unit of rotation as the dimensionl ...
,
RPM5, uses xar.
[RPM 5 package manager](_blank)
/ref>
File structure
The file consists of three sections, the header, the table of contents and the heap. All fields are stored in big endian
In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most sig ...
order.
Header
Table of contents
Xar is different from cpio
cpio is a general file archiver utility and its associated file format. It is primarily installed on Unix-like computer operating systems. The software utility was originally intended as a tape archiving program as part of the Programmer's Workb ...
, tar
Tar is a dark brown or black viscous liquid of hydrocarbons and free carbon, obtained from a wide variety of organic materials through destructive distillation. Tar can be produced from coal, wood, petroleum, or peat. "a dark brown or black bit ...
or ar in that it stores the TOC (table of contents) in the beginning of the file, making appending to an archive more complicated, but making it unnecessary to scan through the archive to extract an individual contained file. The table of contents is stored as a zlib
zlib ( or "zeta-lib", ) is a software library used for data compression. zlib was written by Jean-loup Gailly and Mark Adler and is an abstraction of the DEFLATE compression algorithm used in their gzip file compression program. zlib is also a ...
compressed, UTF-8
UTF-8 is a variable-width encoding, variable-length character encoding used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode'' (or ''Universal Coded Character Set'') ''Transformation Format 8-bit'' ...
encoded, XML document. Each file that is stored in the Xar is independently compressed/encoded. This gives the ability to have the file(s) encoded using gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and in ...
while having another file in the same archive encoded using a different method such as bzip2. On some systems the archive member can also be encoded by xz or lzma compression method.
Example Table of contents
0
20
staff
20
joe
501
0755
directory
com.foobar
20
501
0775
directory
Contents
428
20
1005
a5f6f1461213a904f831d4ef6f214638342842ed
21d21a0c90378248ce0dfb6f345376d1b00d65fc
20
501
0664
file
Info.plist
20
501
0775
directory
Resources
14868
448
274432
efe5c97921de7ccc5aebc158d158e9d4280d6814
45c8be42d1d9afdb57ddd5e9311453010ec46161
20
501
0664
file
foobar
17635
15316
45056
3c761ffcc81ee6e232e4f4a1c4a81654c26c4e52
0ea31f8ef0e5987a1838a64ab5c26ebf3ee4bc37
20
501
0664
file
docSet.skidx
20
501
0775
directory
Documents
35790
32951
209242
5242cd71585c34e722932f324706f8c00e1ae0c5
c0e013e53d829511835e2b429abb5198731e9a3e
20
501
0664
file
foobar.html
References
External links
Original Xar project
(unmaintained)
fork from original project
(unmaintained)
* Apple
Archive formats
{{storage-software-stub