DJV
image/vnd.djvu
Magic Bytes
Offset: 0
41 54 26 54 46 4F 52 4D
DJV (DjVu) is an open file format originally developed by AT&T Labs for the storage and efficient distribution of high-resolution scanned documents. It is primarily utilized by digital libraries and archiving initiatives to compress historical print media while maintaining visual fidelity for text and photographs. Although largely superseded by the PDF format in modern document exchange, DJV remains a secure, low-risk format that lacks the inherent executable scripting vulnerabilities found in more complex document types.
Validation Code
How to validate .djv files in Python
Python
def is_djv(file_path: str) -> bool:
"""Check if file is a valid DJV by magic bytes."""
signature = bytes([0x41, 0x54, 0x26, 0x54, 0x46, 0x4F, 0x52, 0x4D])
with open(file_path, "rb") as f:
return f.read(8) == signature
How to validate .djv files in Node.js
Node.js
function isDJV(buffer: Buffer): boolean {
const signature = Buffer.from([0x41, 0x54, 0x26, 0x54, 0x46, 0x4F, 0x52, 0x4D]);
return buffer.subarray(0, 8).equals(signature);
}
Go
func IsDJV(data []byte) bool {
signature := []byte{0x41, 0x54, 0x26, 0x54, 0x46, 0x4F, 0x52, 0x4D}
if len(data) < 8 {
return false
}
return bytes.Equal(data[:8], signature)
}
API Endpoint
GET
/api/v1/djv
curl https://filesignature.org/api/v1/djv