Brother/Babylock/Bernina Home Embroidery file
application/octet-stream
Magic Bytes
Offset: 0
24 46 4C 32 40 28 23 29 20 53 50 53 53 20 44 41 54 41 20 46 49 4C 45
The Brother Embroidery Format (PES) is a proprietary file type developed by Brother International for use with Babylock, Bernina, and Brother sewing hardware. It stores stitch patterns, color palettes, and design coordinates used to automate the fabrication of textiles via compatible machines. Although the format has seen numerous revisions to accommodate modern hardware features, it remains a standard in the hobbyist community and is inherently safe due to its lack of executable scripts or macros.
Validation Code
How to validate .pes files in Python
Python
def is_pes(file_path: str) -> bool:
"""Check if file is a valid PES by magic bytes."""
signature = bytes([0x24, 0x46, 0x4C, 0x32, 0x40, 0x28, 0x23, 0x29, 0x20, 0x53, 0x50, 0x53, 0x53, 0x20, 0x44, 0x41, 0x54, 0x41, 0x20, 0x46, 0x49, 0x4C, 0x45])
with open(file_path, "rb") as f:
return f.read(23) == signature
How to validate .pes files in Node.js
Node.js
function isPES(buffer: Buffer): boolean {
const signature = Buffer.from([0x24, 0x46, 0x4C, 0x32, 0x40, 0x28, 0x23, 0x29, 0x20, 0x53, 0x50, 0x53, 0x53, 0x20, 0x44, 0x41, 0x54, 0x41, 0x20, 0x46, 0x49, 0x4C, 0x45]);
return buffer.subarray(0, 23).equals(signature);
}
Go
func IsPES(data []byte) bool {
signature := []byte{0x24, 0x46, 0x4C, 0x32, 0x40, 0x28, 0x23, 0x29, 0x20, 0x53, 0x50, 0x53, 0x53, 0x20, 0x44, 0x41, 0x54, 0x41, 0x20, 0x46, 0x49, 0x4C, 0x45}
if len(data) < 23 {
return false
}
return bytes.Equal(data[:23], signature)
}
API Endpoint
GET
/api/v1/pes
curl https://filesignature.org/api/v1/pes