On Mon, 5 Feb 2018, Matteo Alessandroni wrote:
I'm using Apache Tika to detect a file Mime Type from its base64 rapresentation. Unfortunately I don't have other info about the file (e.g. extension).

and it gives me "text/plain" for JSON and PDF files, but I would like to obtain a more specific information: "application/json", "application/pdf" etc...

You can't detect JSON files from mime magic alone - json doesn't have anything unique at the start, just lots of possible different things which also occur in other formats too

Tika can detect a PDF from the magic bytes at the start just fine. Make sure you're actually decoding the base64 representation properly

Nick

Reply via email to