guesses the type of a file from contents