热门问题
时间线
聊天
视角
Xar
来自维基百科,自由的百科全书
Remove ads
XAR為可擴展歸檔格式(英語:eXtensible ARchive format)的縮寫,是一種開源文件歸檔器和其文件格式。它創建於OpenDarwin項目,並在Mac OS X 10.5及更高版本中用於軟體安裝例程,以及在Safari 5.0及更高版本中用於瀏覽器擴展安裝。 它取代了gzip壓縮的pax文件的使用。[2]
文件結構

.xar文件包含三部分:文件頭,目錄表(Table of Contents, TOC)和堆。 所有欄位均按大端順序存儲。[4]
與cpio,tar或ar的不同,Xar將TOC(目錄表)存儲在文件的開頭,這使得附加到歸檔文件變得更加複雜,但是好處是不必掃描整個歸檔文件來提取單個包含的文件。 TOC以UTF-8編碼的XML文檔存儲,zlib壓縮。[6][4] 存儲在Xar中的每個文件都經過獨立壓縮/編碼,可以使用不同的壓縮方法對不同文件進行編碼。在某些系統上,文件還可以通過xz或lzma壓縮方法進行編碼。[5]
TOC示例
<?xml version="1.0" encoding="UTF-8"?>
<xar>
<toc>
<checksum style="sha1">
<offset>0</offset>
<size>20</size>
</checksum>
<file id="1">
<group>staff</group>
<gid>20</gid>
<user>joe</user>
<uid>501</uid>
<mode>0755</mode>
<type>directory</type>
<name>com.foobar</name>
<file id="2">
<group></group>
<gid>20</gid>
<user></user>
<uid>501</uid>
<mode>0775</mode>
<type>directory</type>
<name>Contents</name>
<file id="3">
<data>
<length>428</length>
<offset>20</offset>
<size>1005</size>
<encoding style="application/x-gzip"/>
<archived-checksum style="SHA1">a5f6f1461213a904f831d4ef6f214638342842ed</archived-checksum>
<extracted-checksum style="SHA1">21d21a0c90378248ce0dfb6f345376d1b00d65fc</extracted-checksum>
</data>
<group></group>
<gid>20</gid>
<user></user>
<uid>501</uid>
<mode>0664</mode>
<type>file</type>
<name>Info.plist</name>
</file>
<file id="4">
<group></group>
<gid>20</gid>
<user></user>
<uid>501</uid>
<mode>0775</mode>
<type>directory</type>
<name>Resources</name>
<file id="5">
<data>
<length>14868</length>
<offset>448</offset>
<size>274432</size>
<encoding style="application/x-gzip"/>
<archived-checksum style="SHA1">efe5c97921de7ccc5aebc158d158e9d4280d6814</archived-checksum>
<extracted-checksum style="SHA1">45c8be42d1d9afdb57ddd5e9311453010ec46161</extracted-checksum>
</data>
<group></group>
<gid>20</gid>
<user></user>
<uid>501</uid>
<mode>0664</mode>
<type>file</type>
<name>foobar</name>
</file>
<file id="6">
<data>
<length>17635</length>
<offset>15316</offset>
<size>45056</size>
<encoding style="application/x-gzip"/>
<archived-checksum style="SHA1">3c761ffcc81ee6e232e4f4a1c4a81654c26c4e52</archived-checksum>
<extracted-checksum style="SHA1">0ea31f8ef0e5987a1838a64ab5c26ebf3ee4bc37</extracted-checksum>
</data>
<group></group>
<gid>20</gid>
<user></user>
<uid>501</uid>
<mode>0664</mode>
<type>file</type>
<name>docSet.skidx</name>
</file>
<file id="7">
<group></group>
<gid>20</gid>
<user></user>
<uid>501</uid>
<mode>0775</mode>
<type>directory</type>
<name>Documents</name>
<file id="8">
<data>
<length>35790</length>
<offset>32951</offset>
<size>209242</size>
<encoding style="application/x-gzip"/>
<archived-checksum style="SHA1">5242cd71585c34e722932f324706f8c00e1ae0c5</archived-checksum>
<extracted-checksum style="SHA1">c0e013e53d829511835e2b429abb5198731e9a3e</extracted-checksum>
</data>
<group></group>
<gid>20</gid>
<user></user>
<uid>501</uid>
<mode>0664</mode>
<type>file</type>
<name>foobar.html</name>
</file>
</file>
</file>
</file>
</file>
</toc>
</xar>
Remove ads
參考來源
外部連結
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads