madhums/node-imager — pull request #74 by amitevski (2014-07-11 12:57:03+00:00)
Title: try to infer file type with magic bytes 

if the image has e.g. content-type application/octet-stream, the file is named ...NaN,NaN... Now if the content-type is not in supported content types, the file type is detected by magic numbers (http://en.wikipedia.org/wiki/List_of_file_signatures).