MJS (.mjs)
.mjs file signature | text/javascript
MJS is a JavaScript module file format defined by the ECMAScript standard and maintained by Ecma International through the TC39 standards committee. It is used to organize reusable code in web applications, Node.js projects, and other JavaScript environments that support modular loading. Like other JavaScript files, it should be treated as code and reviewed before execution, but the format itself is generally safe and has no special historical or legacy status.
Magic Bytes
Offset 0
2F 2A 20 6A 51 75 65 72 79 20
Sources: Apache Tika
All Known Signatures
10 signature variants are documented for .mjs files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 2F 2A 20 6A 51 75 65 72 79 20 | 0 | Apache Tika |
| 2F 2A 21 20 6A 51 75 65 72 79 20 | 0 | Apache Tika |
| 2F 2A 21 | 0 | Apache Tika |
| 28 66 75 6E 63 74 69 6F 6E 28 65 2C 75 6E 64 65 66 69 6E 65 64 29 7B | 0 | Apache Tika |
| 21 66 75 6E 63 74 69 6F 6E 28 77 69 6E 64 6F 77 2C 75 6E 64 65 66 69 6E 65 64 29 7B | 0 | Apache Tika |
| 2F 2A 20 20 50 72 6F 74 6F 74 79 70 65 20 4A 61 76 61 53 63 72 69 70 74 20 | 0 | Apache Tika |
| 76 61 72 20 50 72 6F 74 6F 74 79 70 65 3D 7B | 0 | Apache Tika |
| 66 75 6E 63 74 69 6F 6E 20 24 77 28 74 29 7B | 0 | Apache Tika |
| 2F 2A 2A 20 40 6C 69 63 65 6E 73 65 20 52 65 61 63 74 | 0 | Apache Tika |
| 2F 2A 2A | 0 | Apache Tika |
Extension
.mjs
MIME Type
text/javascript
Byte Offset
0
Risk Level
Safe
Validation Code
How to validate .mjs files in Python
def is_mjs(file_path: str) -> bool:
"""Check if file is a valid MJS by magic bytes."""
signature = bytes([0x2F, 0x2A, 0x20, 0x6A, 0x51, 0x75, 0x65, 0x72, 0x79, 0x20])
with open(file_path, "rb") as f:
return f.read(10) == signature
How to validate .mjs files in Node.js
function isMJS(buffer: Buffer): boolean {
const signature = Buffer.from([0x2F, 0x2A, 0x20, 0x6A, 0x51, 0x75, 0x65, 0x72, 0x79, 0x20]);
return buffer.subarray(0, 10).equals(signature);
}
How to validate .mjs files in Go
func IsMJS(data []byte) bool {
signature := []byte{0x2F, 0x2A, 0x20, 0x6A, 0x51, 0x75, 0x65, 0x72, 0x79, 0x20}
if len(data) < 10 {
return false
}
return bytes.Equal(data[:10], signature)
}
API Endpoint
/api/v1/mjs
curl https://filesignature.org/api/v1/mjs
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .mjs file?
A .mjs file is identified by the magic bytes 2F 2A 20 6A 51 75 65 72 79 20 at byte offset 0. MJS is a JavaScript module file format defined by the ECMAScript standard and maintained by Ecma International through the TC39 standards committee. It is used to organize reusable code in web applications, Node.js projects, and other JavaScript environments that support modular loading. Like other JavaScript files, it should be treated as code and reviewed before execution, but the format itself is generally safe and has no special historical or legacy status.
What are the magic bytes for .mjs files?
The magic bytes for MJS files are 2F 2A 20 6A 51 75 65 72 79 20 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .mjs file?
To validate a .mjs file, read the first bytes of the file and compare them against the known magic bytes (2F 2A 20 6A 51 75 65 72 79 20) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .mjs files?
The primary MIME type for .mjs files is text/javascript.
Is it safe to open .mjs files?
MJS (.mjs) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.