Npm's file-type equivalent for elixir

There is this cool npm package called file-type that can recognize the type of a file given its path or its binary content. I use this package to filter out unwanted file types when I’m writing a file upload service. Its useful because frameworks just look at the file extension and you can easily trick them by changing it.
So is there anything like this for elixir?
Thanks

If You are on Linux You might try…

4 Likes

Also have a look at MIME — mime v1.5.0

There are from_path/1 and extensions/1 functions from that module that do what you want.

3 Likes