views:

317

answers:

1

The madness of file extensions and MIME types and creator codes and magic numbers to determine file types is a huge mess. Coming from a background of Cocoa programming, I supposed I'm spoiled: in Tiger, OS X added a system called Uniform Type Identifiers (UTIs) that makes the entire process sane.

Given that I'm doing a bunch of web development in (insert your favorite web development environment here), is there anything similar that's not dependent on running OS X and - better yet - works in multiple programming languages?

Right now, I'm using the file command on Linux to replicate some of the functionality, but it's just not the same. And, of course, everybody has their huge lookup tables, but nothing is centralized.

Has anybody done this or run across this before?

A: 

There just doesn't seem to be any such thing outside of OS X. The file command is the best that you can do on linux, all the file type identification systems I've seen on linux use it internally (when they aren't just using the file extension).

In particular you can use file -i to output a MIME type rather than the plain human-readable strings.

The UTI system seems to have a great deal of useful functionality, maybe if you could tell us what in particular you miss about it that the other methods you've found don't give you, it might be easier for us to find you something useful.

Adam Bellaire