TR
text/troff
Magic Bytes
Offset: 0
2E 5C 22
The TR file format represents a Troff document, which is a typesetting system originally developed by Joe Ossanna at Bell Laboratories for Unix. This format is primarily utilized for producing formatted output for Unix manual pages, technical documentation, and academic papers using processors like groff. Now considered a legacy technology, it remains the standard for terminal-based documentation and is inherently safe due to its plain-text markup structure.
Validation Code
How to validate .tr files in Python
Python
def is_tr(file_path: str) -> bool:
"""Check if file is a valid TR by magic bytes."""
signature = bytes([0x2E, 0x5C, 0x22])
with open(file_path, "rb") as f:
return f.read(3) == signature
How to validate .tr files in Node.js
Node.js
function isTR(buffer: Buffer): boolean {
const signature = Buffer.from([0x2E, 0x5C, 0x22]);
return buffer.subarray(0, 3).equals(signature);
}
Go
func IsTR(data []byte) bool {
signature := []byte{0x2E, 0x5C, 0x22}
if len(data) < 3 {
return false
}
return bytes.Equal(data[:3], signature)
}
API Endpoint
GET
/api/v1/tr
curl https://filesignature.org/api/v1/tr