Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Checks file type from the data.

Component Version macOS Windows Linux Server iOS SDK
Text 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.IdentifyData"; text { ; Encoding } )   More


Parameter Description Example Flags
text The text to check.
Encoding The text encoding for text parameter.
Default is UTF-8 for version.

Can also be "hex" or "base64" to provide data encoded with hex or base64 algorithm.
"Hex" Optional


Returns text or error.


Checks file type from the data.
We read the first bytes of the file and decide which file type is may be.

You may use "Hex" or "base64" as encoding to check type before decoding it.

Supported types:

PDFPDF document.
GIFGIF image.
BMPWindows BMP image
WEBPWebP image.
PNGPNG image.
GIFGIF image.
SVGSVG image.
ZIPZIP file.
HEIFHEIF image file.
FMPFileMaker database.
EXEWindows executable
MachOmacOS executable
ELFLinux executable

Returns empty text in case the format is not identified. We can add more formats as needed.
Please be aware, that a text file may just have the right bytes to look like another file format!


Check content of some hex data:

MBS( "Text.IdentifyData"; "89504E470D0A1A0A000000..."; "Hex" )

Example result: PNG

See also

Release notes

Blog Entries

This function is free to use.

Created 23th December 2023, last changed 8th January 2024

Text.FromStyles - Text.InvalidCharactersForEncoding

💬 Ask a question or report a problem