Determine if a file is really an image in express/node.js

I have used the mmmagic module for this, it discovers mime types: mmmagic on Github


Mime types are not useful. Try magic numbers or purely try to open the file. Read with link for more details. https://stackoverflow.com/a/8475542/1979882

http://www.astro.keele.ac.uk/oldusers/rno/Computing/File_magic.html#Image


Another option is https://github.com/sindresorhus/image-type. Looks like mmmagic relies on libmagic which is a C lib and might be a lot to pull in...