Free Lossless Audio Codec file
audio/flac
Magic Bytes
Offset: 0
66 4C 61 43
The Free Lossless Audio Codec (FLAC) is an open-source audio coding format primarily maintained by the Xiph.Org Foundation. It is widely utilized for archiving CD-quality music and distributing high-resolution audio, enabling significant file size reduction without sacrificing original data integrity. As a royalty-free standard, FLAC provides bit-perfect reconstruction of source audio, distinguishing it from lossy alternatives while presenting negligible security risks during playback.
Validation Code
How to validate .flac files in Python
Python
def is_flac(file_path: str) -> bool:
"""Check if file is a valid FLAC by magic bytes."""
signature = bytes([0x66, 0x4C, 0x61, 0x43])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .flac files in Node.js
Node.js
function isFLAC(buffer: Buffer): boolean {
const signature = Buffer.from([0x66, 0x4C, 0x61, 0x43]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsFLAC(data []byte) bool {
signature := []byte{0x66, 0x4C, 0x61, 0x43}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/flac
curl https://filesignature.org/api/v1/flac