BZ
application/x-bzip
Magic Bytes
Offset: 0
42 5A 30
The BZ file format is a legacy data compression standard originally developed by Julian Seward for Unix-like operating systems. It was primarily utilized for archiving and distributing files efficiently by employing the Burrows-Wheeler transform paired with arithmetic coding algorithms. This format is now considered obsolete and was superseded by bzip2 shortly after its release to avoid potential software patent issues associated with its specific implementation of arithmetic compression.
Validation Code
How to validate .bz files in Python
Python
def is_bz(file_path: str) -> bool:
"""Check if file is a valid BZ by magic bytes."""
signature = bytes([0x42, 0x5A, 0x30])
with open(file_path, "rb") as f:
return f.read(3) == signature
How to validate .bz files in Node.js
Node.js
function isBZ(buffer: Buffer): boolean {
const signature = Buffer.from([0x42, 0x5A, 0x30]);
return buffer.subarray(0, 3).equals(signature);
}
Go
func IsBZ(data []byte) bool {
signature := []byte{0x42, 0x5A, 0x30}
if len(data) < 3 {
return false
}
return bytes.Equal(data[:3], signature)
}
API Endpoint
GET
/api/v1/bz
curl https://filesignature.org/api/v1/bz