Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/robrwo/media-types-simple

Media-Types-Simple
https://github.com/robrwo/media-types-simple

Last synced: 11 days ago
JSON representation

Media-Types-Simple

Awesome Lists containing this project

README

        

NAME
Media::Type::Simple - MIME Types and their file extensions

REQUIREMENTS
The following non-core modules are required:

Exporter::Lite
File::Share
File::ShareDir

SYNOPSIS
use Media::Type::Simple;

$type = type_from_ext("jpg"); # returns "image/jpeg"

$ext = ext_from_type("text/plain"); # returns "txt"

DESCRIPTION
This package gives a simple functions for obtaining common file
extensions from media types, and from obtaining media types from file
extensions.

It is also relaxed with respect to having multiple media types
associated with a file extension, or multiple extensions associated with
a media type, and it includes media types for encodings such as `gzip'.
It is defined this way in the default data, but this does not meet your
needs, then you can have it use a system file (e.g. /etc/mime.types) or
custom data.

By default, there is a functional interface, although you can also use
an object-oriented interface. (Different objects will not share the same
data.)

REVISION HISTORY
For a detailed history see the Changes file included in this
distribution.

SEE ALSO
The MIME::Types module has a similar functionality, but with a more
complex interface.

LWP::MediaTypes will guess the media type from a file extension,
attempting to use the ~/.media.types file.

An "official" list of Media Types can be found at
http://www.iana.org/assignments/media-types.

AUTHOR
Robert Rothenberg

Contributors
Martin McGrath

Acknowledgements
Some of the code comes from self module (by Kang-min Liu). The data for
the media types is based on the Debian `mime-support' package,
http://packages.debian.org/mime-support, although with *many* changes
from the original.

Suggestions and Bug Reporting
Feedback is always welcome. Please use the CPAN Request Tracker at
http://rt.cpan.org to submit bug reports.

The git repository for this module is at
https://github.com/robrwo/Media-Types-Simple.

COPYRIGHT & LICENSE
Copyright 2009-2014 Robert Rothenberg, all rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.