A simple interface to libmagic. Please install the latest version of file(1) to use this. It is most likely that your system's file is outdated and does not come with libmagic. It may be found
at ftp://ftp.astron.com/pub/file/. On the two platforms I use, FreeBSD and OS X, file is located in
sysutils/file in both FreeBSD Ports and
DarwinPorts. Note that though this is only 0.1, I consider it fully usable, since it's just an interface.
This is Public Domain. You may do whatever you wish with the files.
It's available on the RubyForge files page.
> ruby extconf.rb > make # make install
path is the path (or colon-separated paths) to a list of non-compiled magic databases. Compiles the files.
flags may be one or a combination (bitwise or) of the following:
NONE, DEBUG, SYMLINK, COMPRESS, DEVICES, MIME, CONTINUE, CHECK, PRESERVE_ATIME, RAW, ERROR. Please
refer to magic(3) for more information.
path may be the path (or colon-separated paths) to a magic database. Leave
nil to use the default.
path is the path to a file. Returns the type of file as a String. To return a mimetype set the flag
input is a buffer. Works just like file, except reads from input instead.
flags is one or a combinatino of the flags specified above.
path is the path (or colon-separated paths) to a magic database. Returns the validity of entries in that database.
path is the path (or colon-separated paths) to a list of compiled magic databases. Loads the files.