{"success":true,"data":{"ext":"xz","name":"XZ archive file","description":"XZ is a compressed file format and archiving container developed by the Tukaani project, using the LZMA2 compression algorithm. It is commonly used to reduce the size of software packages, source code archives, and other distribution files, and is supported by many Unix-like utilities and package managers. The format is generally considered safe; its main concern is that decompression can require substantial memory or processing time for large or crafted archives.","mime":["application/x-xz"],"risk_level":"Safe","signatures":[{"hex":"FD 37 7A 58 5A 00","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"},{"name":"Wikipedia","url":"https://en.wikipedia.org/wiki/List_of_file_signatures"},{"name":"Gary Kessler","url":"https://www.garykessler.net/library/file_sigs_GCK_latest.html"}]}],"related":["7z","ace","arj","bz","bz2","cab"],"usage":{"python":"def is_xz(file_path: str) -> bool:\n    \"\"\"Check if file is a valid XZ by magic bytes.\"\"\"\n    signature = bytes([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])\n    with open(file_path, \"rb\") as f:\n        return f.read(6) == signature","node":"function isXZ(buffer: Buffer): boolean {\n  const signature = Buffer.from([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00]);\n  return buffer.subarray(0, 6).equals(signature);\n}","go":"func IsXZ(data []byte) bool {\n    signature := []byte{0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00}\n    if len(data) < 6 {\n        return false\n    }\n    return bytes.Equal(data[:6], signature)\n}"},"category":"Archives"}}