mime-types version 2.0 has been released!
- home: http://mime-types.rubyforge.org/
- code: https://github.com/halostatue/mime-types/
- bugs: https://github.com/halostatue/mime-types/issues
- rdoc: http://mime-types.rubyforge.org/
- code climate: <{img
src=“https://codeclimate.com/github/halostatue/mime-types.png”
/}[Builds - halostatue/mime-types - Code Climate]> - continuous integration: <{img
src=“https://travis-ci.org/halostatue/mime-types.png”
/}[Travis CI - Test and Deploy with Confidence]>
The mime-types library provides a library and registry for information
about
MIME content type definitions. It can be used to determine defined
filename
extensions for MIME types, or to use filename extensions to look up the
likely
MIME type definitions.
MIME content types are used in MIME-compliant communications, as in
e-mail or
HTTP traffic, to indicate the type of content which is transmitted. The
mime-types library provides the ability for detailed information about
MIME
entities (provided as an enumerable collection of MIME::Type objects) to
be
determined and used programmatically. There are many types defined by
RFCs and
vendors, so the list is long but by definition incomplete; don’t
hesitate to to
add additional type definitions (see Contributing.rdoc). The primary
sources
for MIME type definitions found in mime-types is the IANA collection of
registrations (see below for the link), RFCs, and W3C recommendations.
The mime-types library uses semantic versioning. This is release 2.0;
there are
incompatible changes in the API provided by mime-types, mostly around
registry
initialization (see History.rdoc for full details), and the removal of
support
for Ruby 1.8 interpreters.
mime-types (previously called MIME::Types for Ruby) was originally based
on
MIME::Types for Perl by Mark Overmeer, copyright 2001 - 2009. It is
built to
conform to the MIME types of RFCs 2045 and 2231. It tracks the {IANA
registry}[Media Types]
({ftp}[ftp://ftp.iana.org/assignments/media-types]) with some unofficial
types
added from the {LTSW
collection}[http://www.ltsw.se/knbase/internet/mime.htp]
and added by the users of mime-types.
Changes:
2.0 / 2013-10-DD
- API Changes (General):
- mime-types is no longer compatible with Ruby 1.8. Additionally, for
its
YAML operations (normally development and test), it requires a YAML
parser
that conforms to the Psych parser, not the Syck parser. This would
only be
a problem with an alternative Ruby 1.9.2 interpreter that does not
implement the Psych parser conventions by requiring +psych+. - MIME::InvalidContentType has been renamed to
MIME::Type::InvalidContentType.
- mime-types is no longer compatible with Ruby 1.8. Additionally, for
- API Changes (MIME::Type):
- Construction of a MIME::Type can be with any of the following
objects:- An array containing a valid content type identifier and an
optional array
of extensions. This allows MIME::Type.new to be used instead of
MIME::Type.from_array for the most common use-case. Fixes #43.
Come up with an appropriate replacement for the common use-case of MIME::Type.from_array · Issue #43 · mime-types/ruby-mime-types · GitHub - A Hash containing the output of MIME::Type#to_h, as would be
deserialized
from the JSON representation of a MIME::Type. This replaces
MIME::Type.from_hash using a different parameter set. - Another MIME::Type.
- A content type identifier string.
- An array containing a valid content type identifier and an
- Assignment of an invalid encoding to MIME::Type#encoding= will raise
a
MIME::Type::InvalidEncoding exception rather than a plain
ArgumentError. - MIME::Type#url has been renamed to MIME::Type#references.
- MIME::Type#use_instead is now tracked as its own attribute, not as
part of
MIME::Type#docs. - MIME::Type#system, MIME::Type#system?, MIME::Type#platform?,
MIME::Type#to_a, MIME::Type#to_hash, MIME::Type.from_array,
MIME::Type.from_hash, and MIME::Type.from_mime_type have been
deprecated
for removal. - Implemented YAML object encoding and decoding methods,
MIME::Type#encode_with and MIME::Type#init_with. - Implemented JSON hash encoding methods.
- Added MIME::Type#add_extensions to easily add extensions to a
MIME::Type.
Fixes #44. Provide MIME::Type#add_extensions · Issue #44 · mime-types/ruby-mime-types · GitHub
- Construction of a MIME::Type can be with any of the following
- API Changes (MIME::Types):
- MIME type caching has been extracted to its own class. It is
structurally
similar to what was introduced with mime-types 1.25, but is no
longer
considered an experimental interface. - MIME type loading has been extracted to its own class. Loading has
changed
substantially. - MIME::Types#[] accepts a new filter flag, :registered. The :platform
flag
has been deprecated. - The MIME::Types#type_for platform parameter has been deprecated.
- Added the ability for MIME::Types#type_for produce results for
multiple
filenames or extensions by providing an array as the first
parameter. Fixes
#42. Allow MIME::Types#type_for to search for multiple results · Issue #42 · mime-types/ruby-mime-types · GitHub - MIME::Types#add_type_variant and MIME::Types#index_extensions have
been
deprecated as public methods. They will be private in a future
version. - MIME::Types#defined_types, MIME::Types.cache_file,
MIME::Types.add_type_variant, and MIME::Types.index_extensions have
been
deprecated for removal.
- MIME type caching has been extracted to its own class. It is
- Default Registry Changes:
- The default registry is now a file in the directory data/, located
via
MIME::Types::Loader::PATH. +PATH+ is defined in the file
lib/mime/types/path.rb so that system packagers only have to modify
one
file in order to put the registry in a location that is not where a
gem
version of mime-types would expect it. This resolves issue #36,
reported by
postmodern. Move all non-code files into data/ · Issue #36 · mime-types/ruby-mime-types · GitHub - The default registry is now a single file in JSON format. This
resolves
issue #28 reported by jasonlor (an error with mime-types in
MacRuby).
Issue compiling mime-types in MacRuby · Issue #28 · mime-types/ruby-mime-types · GitHub - The default registry is compiled from YAML files in type-lists/,
resolving
issue #37 reported by postmodern requesting an easier-to-edit
format.
Consider switching to YAML or CSV · Issue #37 · mime-types/ruby-mime-types · GitHub
- The default registry is now a file in the directory data/, located
- New or Updated MIME Types:
- Major updates to the registered MIME type list from IANA using the
improved
developer tools. - Added:
- application/xhtml+xml (HTML5)
- multipart/x-mixed-replace (HTML5)
- application/vnd.apple.pkpass (Apple PassBook) with extension
pkpass.
- Modified:
- application/gzip (RFC6713) added extension (gz) and encoding.
- application/epub+zip is not a registered MIME type.
- application/rss+xml is not a registered MIME type.
- application/x-director reported incorrect extensions.
- application/x-gzip marked as obsolete (use application/gzip
instead). - application/x-maker marked as obsolete (use
application/vnd.framemaker
instead). - image/webp is not a registered MIME type; added a URL to Google’s
proposed standard document. - text/html added URL to the HTML5 specification.
- text/cache-manifest added URL to the HTML5 specification.
- text/plain (VMS .doc files) marked as non-standard. This type will
be
merged with the standard text/plain type in a future release. - Added md, markdown, rst, and textile extensions to text/plain.
- Major updates to the registered MIME type list from IANA using the
- MIME Type Development Tools
- The benchmarking task has been moved mostly to
support/benchmarker.rb. - A task for SimpleCov coverage has been added (rake
test:coverage). - IANA type registry downloading has been substantially improved and
the
implementation no longer resides in the Rakefile; it has instead
been moved
to support/iana_downloader.rb. This takes advantage of the new YAML
encoding functionality to update added or modified MIME types
non-destructively in type-lists/ by default. - Rake tasks convert:yaml:json and convert:json:yaml
provide functionality to convert the human-editable YAML format in
type-lists/ to the JSON format in data/ and
vice-versa.
This is powered by support/convert.rb.
- The benchmarking task has been moved mostly to