File::Type - determine file type using magic
my $ft = File::Type->new();
# read in data from file to $data, then my $type_from_data = $ft->checktype_data($data);
# alternatively, check file from disk my $type_from_file = $ft->checktype_filename($file);
File::Type uses magic numbers (typically at the start of a file) to determine the MIME type of that file.
File::Type can use either a filename, or file contents, to determine the type of a file.
Returns a new File::Type object.
checktype_filename($filename)
Opens $filename (if possible) and returns the MIME type of the file.
checktype_contents($data)
Matches $data against the magic database criteria and returns the MIME type of the file.
* Add additional magic match criteria
* Automatically find mime type whether passed data or a filename.
None known.
Some magic definitions in the mime-magic file vary from those in other apps (eg image/x-png not image/png).
Paul Mison <pmison@fotango.com>
the File::MMagic manpage and the File::MimeInfo manpage do the same job, but parse the magic file at runtime, rather than compiling it into code beforehand.
the File::Type::Builder manpage, which generates the code at the heart of this module.
This module is released under the same terms as Perl itself.
$Header: /usr/local/repository/Vendor/Fotango/File-Type/t/files/File-Type.html,v 1.1 2003/08/22 15:43:23 paul Exp $