Z
application/x-compress
Magic Bytes
Offset: 0
1F 9D
The Z file format is a legacy data compression standard developed by Spencer Thomas and James Woods for the Unix compress utility. It was primarily utilized for reducing the size of software packages and system archives across early Unix-based operating systems. Although now largely obsolete and replaced by modern tools like GZIP, the format is considered safe as it does not inherently support executable code or script embedding during the decompression process.
Validation Code
How to validate .z files in Python
Python
def is_z(file_path: str) -> bool:
"""Check if file is a valid Z by magic bytes."""
signature = bytes([0x1F, 0x9D])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .z files in Node.js
Node.js
function isZ(buffer: Buffer): boolean {
const signature = Buffer.from([0x1F, 0x9D]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsZ(data []byte) bool {
signature := []byte{0x1F, 0x9D}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/z
curl https://filesignature.org/api/v1/z