magicffi
Magicffi is a CFFI interface to libmagic(3), the file type determination library using magic numbers. It can be used to guess file formats.

It's written by Desmond O. Chang and can be found at http://common-lisp.net/project/magicffi/. Source code is at http://github.com/dochang/magicffi.