TZX
application/x-spectrum-tzx
Magic Bytes
Offset: 0
5A 58 54 61 70 65 21 1A
The TZX format is a digital storage standard developed by Tomaz Kac for preserving software compatible with the Sinclair ZX Spectrum. It is primarily utilized by emulators to replicate the exact timing and data structures of original magnetic cassette tapes, including complex custom loaders and copy-protection mechanisms. As a legacy format, it is considered safe for use, serving as a standard tool for vintage computing archivists and retro-gaming enthusiasts worldwide.
Validation Code
How to validate .tzx files in Python
Python
def is_tzx(file_path: str) -> bool:
"""Check if file is a valid TZX by magic bytes."""
signature = bytes([0x5A, 0x58, 0x54, 0x61, 0x70, 0x65, 0x21, 0x1A])
with open(file_path, "rb") as f:
return f.read(8) == signature
How to validate .tzx files in Node.js
Node.js
function isTZX(buffer: Buffer): boolean {
const signature = Buffer.from([0x5A, 0x58, 0x54, 0x61, 0x70, 0x65, 0x21, 0x1A]);
return buffer.subarray(0, 8).equals(signature);
}
Go
func IsTZX(data []byte) bool {
signature := []byte{0x5A, 0x58, 0x54, 0x61, 0x70, 0x65, 0x21, 0x1A}
if len(data) < 8 {
return false
}
return bytes.Equal(data[:8], signature)
}
API Endpoint
GET
/api/v1/tzx
curl https://filesignature.org/api/v1/tzx