Is there a command line utility to which I can pass a filename, that will return applicable UTIs for that file?
hypothetical-uti-fetcher /Library/Desktop\ Pictures/Aqua\ Blue.jpg
might give me:
public.jpeg public.image public.data
You can use the
mdls command to find the UTI for a file:
mdls /Library/Desktop\ Pictures/Aqua\ Blue.jpg
and it will give you a bunch of info, toward the top it will say something like
kMDItemContentType = "public.plain-text"
Hope this helps!
The mdls command only seems to work on Spotlight indexed files. If you run it on a mounted disk image, cd or thumb drive it may return no information at all.
When you're developing a Quicklook Plugin it's also useful to use the following command to see what UTIs Quicklook thinks a file has and which plugins it uses for the preview:
qlmanage -d 4 -p /path/to/file