Alex Rivera | Logout

How many bytes are required for accurate MIME type detection?

Asked 2011-12-29T21:01:47.163
11

There are many libraries and utilities for trying to guess a file's MIME type from content, rather than simply using file name extensions. While some libraries simply take an open file handle, others expect to be passed actual data.

When passing data to a library, how many bytes are required to obtain an accurate MIME type?

Alternatively, at what point are you passing in extra information for no gain in reliability?

Edit
Report

1 Answer

9

This File Signature Table may be helpful. There are a lot of file types described in it.

The amount of bytes required to determine a file type cannot be determined, since some files have static signatures at 512 bytes offset (like PDB), while others have signatures in trailers (like TGA).

In most of the files listed in the table, the signature does not exceed 24 bytes in length.

answered 2013-07-19T08:47:43.493

Your Answer