P02
application/octet-stream
Magic Bytes
Offset: 0
43 36 34 46 69 6C 65 00
The P02 file format is a legacy container format developed for the Commodore 64 ecosystem to preserve original filename metadata when transferring data to non-native platforms. It is primarily utilized within the retro-computing community to package software, games, and data for use with Commodore 64 emulators and modern storage interfaces. Although this format is considered safe and contains no executable code for modern operating systems, it remains a historical standard for maintaining file integrity across incompatible file systems.
Validation Code
How to validate .p02 files in Python
Python
def is_p02(file_path: str) -> bool:
"""Check if file is a valid P02 by magic bytes."""
signature = bytes([0x43, 0x36, 0x34, 0x46, 0x69, 0x6C, 0x65, 0x00])
with open(file_path, "rb") as f:
return f.read(8) == signature
How to validate .p02 files in Node.js
Node.js
function isP02(buffer: Buffer): boolean {
const signature = Buffer.from([0x43, 0x36, 0x34, 0x46, 0x69, 0x6C, 0x65, 0x00]);
return buffer.subarray(0, 8).equals(signature);
}
Go
func IsP02(data []byte) bool {
signature := []byte{0x43, 0x36, 0x34, 0x46, 0x69, 0x6C, 0x65, 0x00}
if len(data) < 8 {
return false
}
return bytes.Equal(data[:8], signature)
}
API Endpoint
GET
/api/v1/p02
curl https://filesignature.org/api/v1/p02