PostScript file
application/postscript
Magic Bytes
Offset: 0
25 21
PostScript (PS) is a page description language and programming language developed by Adobe Systems for electronic publishing and desktop printing. It is primarily used to send complex document data to laser printers and high-resolution imagesetters to ensure accurate graphical output. While it has been largely superseded by the Portable Document Format (PDF) for digital document distribution, PostScript remains an industry standard for professional printing workflows and legacy hardware support.
Validation Code
How to validate .ps files in Python
Python
def is_ps(file_path: str) -> bool:
"""Check if file is a valid PS by magic bytes."""
signature = bytes([0x25, 0x21])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .ps files in Node.js
Node.js
function isPS(buffer: Buffer): boolean {
const signature = Buffer.from([0x25, 0x21]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsPS(data []byte) bool {
signature := []byte{0x25, 0x21}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/ps
curl https://filesignature.org/api/v1/ps