File::Type - determine file type using magic

- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS

- new
- `checktype_filename($filename)`
- `checktype_contents($data)`

- TODO
- BUGS

- NOTES

- AUTHOR
- SEE ALSO
- LICENCE
- CVS

# NAME

File::Type - determine file type using magic

# SYNOPSIS

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);

# DESCRIPTION

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.

# METHODS

## new

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.

# TODO

* Add additional magic match criteria

* Automatically find mime type whether passed data or a filename.

# BUGS

None known.

## NOTES

Some magic definitions in the mime-magic file vary from those in other apps (eg image/x-png not image/png).

# AUTHOR

Paul Mison <pmison@fotango.com>

# SEE ALSO

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.

# LICENCE

This module is released under the same terms as Perl itself.

# CVS

$Header: /usr/local/repository/Vendor/Fotango/File-Type/t/files/File-Type.html,v 1.1 2003/08/22 15:43:23 paul Exp $