eXtensible ARchivefile
application/vnd.xara
Magic Bytes
Offset: 0
78 61 72 21
eXtensible ARchive (XAR) is an open file archiving format developed by the OpenDarwin project to provide an alternative to existing tar and cpio formats. It is predominantly utilized for software distribution packages on macOS and as a payload container within Red Hat Package Manager (RPM) files. While considered a secure and efficient format for data compression, its adoption remains largely confined to specific operating systems, and it is frequently viewed as a legacy standard in favor of newer archive structures.
Validation Code
How to validate .xar files in Python
Python
def is_xar(file_path: str) -> bool:
"""Check if file is a valid XAR by magic bytes."""
signature = bytes([0x78, 0x61, 0x72, 0x21])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .xar files in Node.js
Node.js
function isXAR(buffer: Buffer): boolean {
const signature = Buffer.from([0x78, 0x61, 0x72, 0x21]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsXAR(data []byte) bool {
signature := []byte{0x78, 0x61, 0x72, 0x21}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/xar
curl https://filesignature.org/api/v1/xar