DVI
application/x-dvi
Magic Bytes
Offset: 0
F7 02
Device Independent (DVI) is a binary file format developed by David R. Fuchs as the primary output for Donald Knuth’s TeX typesetting system. It is used to store document layout data for previewing or subsequent conversion into printer-specific formats such as PostScript and PDF. While the format is considered inherently safe due to its lack of scriptable content, it is primarily categorized as a legacy standard in modern academic publishing workflows.
Validation Code
How to validate .dvi files in Python
Python
def is_dvi(file_path: str) -> bool:
"""Check if file is a valid DVI by magic bytes."""
signature = bytes([0xF7, 0x02])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .dvi files in Node.js
Node.js
function isDVI(buffer: Buffer): boolean {
const signature = Buffer.from([0xF7, 0x02]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsDVI(data []byte) bool {
signature := []byte{0xF7, 0x02}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/dvi
curl https://filesignature.org/api/v1/dvi