ByteArrayFormat
ByteArrayFormat[ba] attempts to determine what ImportByteArray format could be used to import the ByteArray object ba.
Examples
Detect format of byte array:
ba = ExportByteArray[Plot[Sin[x], {x, 0, 2 Pi}], "PNG"];
ByteArrayFormat[ba]
(* "PNG" *)Please visit the official Wolfram Language Reference for more details.