vCard file
text/vcard
Magic Bytes
Offset: 0
42 45 47 49 4E 3A 56 43 41 52 44
The vCard file format (VCF) is a standard for electronic business cards developed by the Versit consortium and maintained by the Internet Engineering Task Force. It is primarily used to exchange contact information, such as names, telephone numbers, and addresses, across various email clients, mobile devices, and organizational software. While inherently safe, the format has evolved through several iterations to improve interoperability and ensure standardized character encoding across international software platforms.
Validation Code
How to validate .vcf files in Python
Python
def is_vcf(file_path: str) -> bool:
"""Check if file is a valid VCF by magic bytes."""
signature = bytes([0x42, 0x45, 0x47, 0x49, 0x4E, 0x3A, 0x56, 0x43, 0x41, 0x52, 0x44])
with open(file_path, "rb") as f:
return f.read(11) == signature
How to validate .vcf files in Node.js
Node.js
function isVCF(buffer: Buffer): boolean {
const signature = Buffer.from([0x42, 0x45, 0x47, 0x49, 0x4E, 0x3A, 0x56, 0x43, 0x41, 0x52, 0x44]);
return buffer.subarray(0, 11).equals(signature);
}
Go
func IsVCF(data []byte) bool {
signature := []byte{0x42, 0x45, 0x47, 0x49, 0x4E, 0x3A, 0x56, 0x43, 0x41, 0x52, 0x44}
if len(data) < 11 {
return false
}
return bytes.Equal(data[:11], signature)
}
API Endpoint
GET
/api/v1/vcf
curl https://filesignature.org/api/v1/vcf