MIME
message/rfc822
Magic Bytes
Offset: 0
23 21 20 72 6E 65 77 73
Multipurpose Internet Mail Extensions (MIME) is an internet standard developed by the IETF to extend email messages to support non-ASCII text and multimedia attachments. It serves as the fundamental structure for modern email transmission and Usenet newsgroup exchanges, facilitating the transfer of rich media across diverse systems. While the text-based container structure is inherently safe, parsed content within the message body can harbor malicious payloads, necessitating robust handling by mail clients.
Validation Code
How to validate .mime files in Python
Python
def is_mime(file_path: str) -> bool:
"""Check if file is a valid MIME by magic bytes."""
signature = bytes([0x23, 0x21, 0x20, 0x72, 0x6E, 0x65, 0x77, 0x73])
with open(file_path, "rb") as f:
return f.read(8) == signature
How to validate .mime files in Node.js
Node.js
function isMIME(buffer: Buffer): boolean {
const signature = Buffer.from([0x23, 0x21, 0x20, 0x72, 0x6E, 0x65, 0x77, 0x73]);
return buffer.subarray(0, 8).equals(signature);
}
Go
func IsMIME(data []byte) bool {
signature := []byte{0x23, 0x21, 0x20, 0x72, 0x6E, 0x65, 0x77, 0x73}
if len(data) < 8 {
return false
}
return bytes.Equal(data[:8], signature)
}
API Endpoint
GET
/api/v1/mime
curl https://filesignature.org/api/v1/mime