BeechCMS / @beechcms/core / verifyMagicBytes
Function: verifyMagicBytes()
verifyMagicBytes(
buffer,declaredMime):MagicBytesValidationResult
Validates that an uploaded file's binary content matches its declared MIME type, protecting against MIME-spoofing, disguised executables, and blocked formats (e.g. SVG).
Parameters
buffer
ArrayBuffer | Uint8Array<ArrayBufferLike>
The raw binary buffer (ArrayBuffer or Uint8Array).
declaredMime
string
The client-declared MIME type string.
Returns
A MagicBytesValidationResult indicating validity and details.