Adobe encapsulated PostScript file
application/postscript
Magic Bytes
Offset: 0
25 21 50 53 2D 41 64 6F 62 65 2D 33 2E 30 20 45 50 53 46 2D 33 2E 30
Encapsulated PostScript (EPS) is a graphics file format developed by Adobe Systems to represent vector-based illustrations and high-resolution bitmap images. This legacy format is primarily used for cross-platform exchange of visual assets and professional printing workflows within desktop publishing software environments. Although largely superseded by the Portable Document Format (PDF), EPS remains supported for backwards compatibility but requires caution because the format can execute arbitrary PostScript code during the rendering process.
Validation Code
How to validate .eps files in Python
Python
def is_eps(file_path: str) -> bool:
"""Check if file is a valid EPS by magic bytes."""
signature = bytes([0x25, 0x21, 0x50, 0x53, 0x2D, 0x41, 0x64, 0x6F, 0x62, 0x65, 0x2D, 0x33, 0x2E, 0x30, 0x20, 0x45, 0x50, 0x53, 0x46, 0x2D, 0x33, 0x2E, 0x30])
with open(file_path, "rb") as f:
return f.read(23) == signature
How to validate .eps files in Node.js
Node.js
function isEPS(buffer: Buffer): boolean {
const signature = Buffer.from([0x25, 0x21, 0x50, 0x53, 0x2D, 0x41, 0x64, 0x6F, 0x62, 0x65, 0x2D, 0x33, 0x2E, 0x30, 0x20, 0x45, 0x50, 0x53, 0x46, 0x2D, 0x33, 0x2E, 0x30]);
return buffer.subarray(0, 23).equals(signature);
}
Go
func IsEPS(data []byte) bool {
signature := []byte{0x25, 0x21, 0x50, 0x53, 0x2D, 0x41, 0x64, 0x6F, 0x62, 0x65, 0x2D, 0x33, 0x2E, 0x30, 0x20, 0x45, 0x50, 0x53, 0x46, 0x2D, 0x33, 0x2E, 0x30}
if len(data) < 23 {
return false
}
return bytes.Equal(data[:23], signature)
}
API Endpoint
GET
/api/v1/eps
curl https://filesignature.org/api/v1/eps