File::Type uses magic numbers (typically at the start of a file) to determine the MIME type of that file. File::Type can use either a filename, or file contents, to determine the type of a file.