XPCOM type libraries for the XPIDL compiler
application/octet-stream
Magic Bytes
Offset: 0
48 48 47 42 31
The XPCOM Type Library (XPT) is a binary file format created by the Mozilla Foundation for use with the Cross-Platform Component Object Model. These files contain interface descriptions generated by the XPIDL compiler, allowing different programming languages to interact with XPCOM components within the Firefox web browser and related software. Now considered a legacy format, modern versions of the Mozilla platform have largely transitioned to more efficient IDL implementations, though XPT remains relevant for older extension architectures.
Validation Code
How to validate .xpt files in Python
Python
def is_xpt(file_path: str) -> bool:
"""Check if file is a valid XPT by magic bytes."""
signature = bytes([0x48, 0x48, 0x47, 0x42, 0x31])
with open(file_path, "rb") as f:
return f.read(5) == signature
How to validate .xpt files in Node.js
Node.js
function isXPT(buffer: Buffer): boolean {
const signature = Buffer.from([0x48, 0x48, 0x47, 0x42, 0x31]);
return buffer.subarray(0, 5).equals(signature);
}
Go
func IsXPT(data []byte) bool {
signature := []byte{0x48, 0x48, 0x47, 0x42, 0x31}
if len(data) < 5 {
return false
}
return bytes.Equal(data[:5], signature)
}
API Endpoint
GET
/api/v1/xpt
curl https://filesignature.org/api/v1/xpt