xar (archiver)
{{Redirect|XAR|other uses|Xar (disambiguation){{!}}Xar}}
{{lowercase title}}
{{Infobox file format
| name = XAR
| icon =
| logo =
| screenshot =
| caption =
|_noextcode = on
| extensions = {{code|.xar}}, Installer (macOS), .XIP
| mime = application/x-xar{{cite web|url=https://reposcope.com/mimetype/application/x-xar|language=en|title=application/x-xar|access-date=2019-03-19}}
| type code =
| uniform type = com.apple.xar-archive
| magic = xar!
| owner =
| released =
| latest release version =
| latest release date =
| genre = archive file format
| container for =
| contained by =
| extended to =
| standard =
| free =
| url =
}}
XAR (short for eXtensible ARchive format) is an open source file archiver and the default file format of macOS’s archiver app. It was created within the OpenDarwin project and is used in macOS X 10.5 and up for software installation routines, as well as browser extensions in Safari 5.0 and up. Xar replaced the use of gzipped pax files.[http://www.nabble.com/xar-in-Mac-OS-X-t2081148.html Nabble – xar in Mac OS X] {{webarchive |url=https://web.archive.org/web/20070207045420/http://www.nabble.com/xar-in-Mac-OS-X-t2081148.html |date=February 7, 2007 }}
One development branch of RPM, RPM5, uses xar.[http://rpm5.org/roadmap.php RPM 5 package manager]
File structure
The file consists of three sections, the header, the table of contents and the heap. All fields are stored in big endian order.{{Cite web|url=https://github.com/mackyle/xar/wiki/xarformat|title=Xarformat · mackyle/Xar Wiki|website=GitHub }}
= Header =
class="wikitable"
! Offset# ! Size ! Purpose |
0
| 4 | File signature used to identify the file format as Xar. |
4
| 2 | Header size |
6
| 2 | Version of Xar format to use. |
8
|8 |Length of the TOC compressed data. |
16
|8 |Length of the TOC uncompressed data. |
24
|4 |Checksum algorithm:{{plainlist}}
{{endplainlist}} |
28
|0, 4, 36 |sometimes padding bytes or checksum algorithm name |
= Table of contents =
Xar is different from cpio, tar 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 compressed, UTF-8 encoded, XML document.{{Cite web|url=https://code.google.com/archive/p/xar/wikis/xarformat.wiki|title = Google Code Archive - Long-term storage for Google Code Project Hosting}} Each file that is stored in the Xar is independently compressed/encoded. This gives the ability to have the file(s) encoded using gzip 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
References
{{Reflist}}
External links
{{Portal|Free and open-source software}}
- [https://code.google.com/p/xar/ Original Xar project] (unmaintained)
- [https://mackyle.github.io/xar/ fork from original project] (unmaintained)
- Apple {{github|apple-oss-distributions/xar}}
{{Archive formats}}
{{DEFAULTSORT:Xar (Archiver)}}
{{storage-software-stub}}