A summary of data about the Ruby ecosystem.

https://github.com/mime-types/ruby-mime-types

Ruby MIME type registry library
https://github.com/mime-types/ruby-mime-types

Keywords

mime-types ruby

Keywords from Contributors

activerecord rubygems mvc activejob rack rspec crash-reporting rubocop sinatra feature-flag

Last synced: about 2 hours ago
JSON representation

Repository metadata

Ruby MIME type registry library

README.md

mime-types for Ruby

Description

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.

Version 3.0 is a major release that requires Ruby 2.0 compatibility and removes
deprecated functions. The columnar registry format introduced in 2.6 has been
made the primary format; the registry data has been extracted from this library
and put into mime-types-data. Additionally, mime-types is now licensed
exclusively under the MIT licence and there is a code of conduct in effect.
There are a number of other smaller changes described in the History file.

About MIME Media Types

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. There are many types defined by RFCs and vendors, so the
list is long but by definition incomplete; don't hesitate to add additional type
definitions. MIME type definitions found in mime-types are from RFCs, W3C
recommendations, the IANA Media Types registry, and user
contributions. It conforms to RFCs 2045 and 2231.

mime-types 3.x

Users are encouraged to upgrade to mime-types 3.x as soon as is practical.
mime-types 3.x requires Ruby 2.0 compatibility and a simpler licensing scheme.

Synopsis

MIME types are used in MIME entities, as in email or HTTP traffic. It is useful
at times to have information available about MIME types (or, inversely, about
files). A MIME::Type stores the known information about one MIME type.

require 'mime/types'

plaintext = MIME::Types['text/plain'] # => [ text/plain ]
text = plaintext.first
puts text.media_type            # => 'text'
puts text.sub_type              # => 'plain'

puts text.extensions.join(' ')  # => 'txt asc c cc h hh cpp hpp dat hlp'
puts text.preferred_extension   # => 'txt'
puts text.friendly              # => 'Text Document'
puts text.i18n_key              # => 'text.plain'

puts text.encoding              # => quoted-printable
puts text.default_encoding      # => quoted-printable
puts text.binary?               # => false
puts text.ascii?                # => true
puts text.obsolete?             # => false
puts text.registered?           # => true
puts text.provisional?          # => false
puts text.complete?             # => true

puts text                       # => 'text/plain'

puts text == 'text/plain'       # => true
puts 'text/plain' == text       # => true
puts text == 'text/x-plain'     # => false
puts 'text/x-plain' == text     # => false

puts MIME::Type.simplified('x-appl/x-zip') # => 'x-appl/x-zip'
puts MIME::Type.i18n_key('x-appl/x-zip') # => 'x-appl.x-zip'

puts text.like?('text/x-plain') # => true
puts text.like?(MIME::Type.new('x-text/x-plain')) # => true

puts text.xrefs.inspect # => { "rfc" => [ "rfc2046", "rfc3676", "rfc5147" ] }
puts text.xref_urls # => [ "http://www.iana.org/go/rfc2046",
                    #      "http://www.iana.org/go/rfc3676",
                    #      "http://www.iana.org/go/rfc5147" ]

xtext = MIME::Type.new('x-text/x-plain')
puts xtext.media_type # => 'text'
puts xtext.raw_media_type # => 'x-text'
puts xtext.sub_type # => 'plain'
puts xtext.raw_sub_type # => 'x-plain'
puts xtext.complete? # => false

puts MIME::Types.any? { |type| type.content_type == 'text/plain' } # => true
puts MIME::Types.all?(&:registered?) # => false

# Various string representations of MIME types
qcelp = MIME::Types['audio/QCELP'].first # => audio/QCELP
puts qcelp.content_type         # => 'audio/QCELP'
puts qcelp.simplified           # => 'audio/qcelp'

xwingz = MIME::Types['application/x-Wingz'].first # => application/x-Wingz
puts xwingz.content_type        # => 'application/x-Wingz'
puts xwingz.simplified          # => 'application/x-wingz'

Columnar Store

mime-types uses as its primary registry storage format a columnar storage format
reducing the default memory footprint. This is done by selectively loading the
data on a per-attribute basis. When the registry is first loaded from the
columnar store, only the canonical MIME content type and known extensions and
the MIME type will be connected to its loading registry. When other data about
the type is required (including preferred_extension, obsolete?, and
registered?) that data is loaded from its own column file for all types in the
registry.

The load of any column data is performed with a Mutex to ensure that types are
updated safely in a multithreaded environment. Benchmarks show that while
columnar data loading is slower than the JSON store, it cuts the memory use by a
third over the JSON store.

If you prefer to load all the data at once, this can be specified in your
application Gemfile as:

gem 'mime-types', require: 'mime/types/full'

Projects that do not use Bundler should require the same:

require 'mime/types/full'

Libraries that use mime-types are discouraged from choosing the JSON store.

For applications and clients that used mime-types 2.6 when the columnar store
was introduced, the require used previously will still work through at least
version 4 and possibly beyond; it is effectively an empty
operation. You are recommended to change your Gemfile as soon as is practical.

require 'mime/types/columnar'

Note that MIME::Type::Columnar and MIME::Types::Columnar are considered private
variant implementations of MIME::Type and MIME::Types and the specific
implementation should not be relied upon by consumers of the mime-types library.
Instead, depend on the public implementations (MIME::Type and MIME::Types) only.

Cached Storage

mime-types supports a cache of MIME types using Marshal.dump. The cache is
invalidated for each version of the mime-types-data gem so that data version
3.2015.1201 will not be reused with data version 3.2016.0101. If the environment
variable RUBY_MIME_TYPES_CACHE is set to a cache file, mime-types will attempt
to load the MIME type registry from the cache file. If it cannot, it will load
the types normally and then saves the registry to the cache file.

The caching works with both full stores and columnar stores. Only the data that
has been loaded prior to saving the cache will be stored.

mime-types Modified Semantic Versioning

The mime-types library has one version number, but this single version number
tracks both API changes and registry data changes; this is not wholly compatible
with all aspects of Semantic Versioning; removing a MIME type from the
registry could be considered a breaking change under some interpretations of
semantic versioning (as lookups for that particular type would no longer work by
default).

mime-types itself uses a modified semantic versioning scheme. Given the version
MAJOR.MINOR:

  1. If an incompatible API (code) change is made, the MAJOR version will be
    incremented and both MINOR and PATCH will be set to zero. Major version
    updates will also generally break Ruby version compatibility guarantees.

  2. If an API (code) feature is added that does not break compatibility, the
    MINOR version will be incremented and PATCH will be set to zero.

  3. If there is a bug fix to a feature added in the most recent MAJOR.MINOR
    release, the PATCH value will be incremented.

In practical terms, there will be fewer releases of mime-types focussing on
features because of the existence of the mime-types-data gem, and if
features are marked deprecated in the course of mime-types 3.x, they will not be
removed until mime-types 4.x or possibly later.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 452
Total Committers: 62
Avg Commits per committer: 7.29
Development Distribution Score (DDS): 0.515

Commits in past year: 91
Committers in past year: 4
Avg Commits per committer in past year: 22.75
Development Distribution Score (DDS) in past year: 0.308

Name Email Commits
Austin Ziegler a****n@z****a 219
dependabot[bot] 4****] 63
Austin Ziegler a****n@s****m 22
Tom Copeland t****m@r****g 22
Austin Ziegler a****n@h****a 19
Austin Ziegler a****n@r****g 14
Andre Pankratz a****e@w****m 11
Garret Alfert a****t@w****e 8
Jeremy Evans c****e@j****t 4
(no author) (****) 4
Postmodern p****3@g****m 3
Juanito Fatas k****0@g****m 3
Dillon Welch d****8@g****m 3
Arnaud Meuret a****d@m****t 3
Keerthi Siva k****v@g****m 2
Igor Victor g****a@y****u 2
Austin Ziegler a****r@c****m 2
Olle Jonsson o****n@g****m 2
Peter Goldstein p****n@g****m 2
mishina t****8@g****m 2
Aaron Patterson a****n@g****m 1
Aggelos Avgerinos a****s@s****r 1
Al Snow j****w@h****m 1
Alex Vondrak a****k@g****m 1
Austin Ziegler a****n@a****m 1
unknown g****e@r****g 1
Todd Carrico t****o@r****g 1
Steven Thomas s****s@s****m 1
Richard Hurt r****t@c****m 1
Martin d'Allens c****r@g****m 1
and 32 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 46
Total pull requests: 202
Average time to close issues: over 1 year
Average time to close pull requests: about 2 months
Total issue authors: 35
Total pull request authors: 44
Average comments per issue: 4.76
Average comments per pull request: 1.43
Merged pull request: 155
Bot issues: 0
Bot pull requests: 112

Past year issues: 1
Past year pull requests: 132
Past year average time to close issues: about 2 months
Past year average time to close pull requests: about 18 hours
Past year issue authors: 1
Past year pull request authors: 5
Past year average comments per issue: 5.0
Past year average comments per pull request: 1.11
Past year merged pull request: 98
Past year bot issues: 0
Past year bot pull requests: 112

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/mime-types/ruby-mime-types

Top Issue Authors

  • halostatue (9)
  • ioquatix (3)
  • nirvdrum (2)
  • envygeeks (1)
  • jasnow (1)
  • slonopotamus (1)
  • losadaem (1)
  • ajvondrak (1)
  • HoneyryderChuck (1)
  • kirillzhiganov (1)
  • ToadJamb (1)
  • jjb (1)
  • gaoguoxin (1)
  • galal-hussein (1)
  • jeremyevans (1)

Top Pull Request Authors

  • dependabot[bot] (112)
  • halostatue (36)
  • jeremyevans (4)
  • olleolleolle (2)
  • mishina2228 (2)
  • mjankowski (2)
  • nna774 (2)
  • OddBloke (2)
  • dogweather (2)
  • m-nakamura145 (2)
  • Muqeet1 (2)
  • JuanitoFatas (2)
  • ajvondrak (1)
  • losadaem (1)
  • jasnow (1)

Top Issue Labels

  • Feature (9)
  • Bug (9)
  • Documentation (3)
  • Security (1)
  • Updated MIME Type (1)

Top Pull Request Labels

  • dependencies (112)
  • github_actions (112)
  • Bug (3)
  • Feature (1)

Package metadata

gem.coop: mime-types

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. Version 3.0 is a major release that requires Ruby 2.0 compatibility and removes deprecated functions. The columnar registry format introduced in 2.6 has been made the primary format; the registry data has been extracted from this library and put into [mime-types-data][data]. Additionally, mime-types is now licensed exclusively under the MIT licence and there is a code of conduct in effect. There are a number of other smaller changes described in the History file.

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Documentation: http://www.rubydoc.info/gems/mime-types/
  • Licenses: MIT
  • Latest release: 3.7.0 (published 10 months ago)
  • Last Synced: 2026-03-02T04:33:14.219Z (1 day ago)
  • Versions: 49
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 876,105,054 Total
  • Docker Downloads: 2,006,829,051
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.005%
    • Downloads: 0.016%
  • Maintainers (1)
ubuntu-22.04: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Licenses: other
  • Latest release: 3.3.1-1 (published 18 days ago)
  • Last Synced: 2026-02-13T13:20:29.135Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.374%
    • Forks count: 0.563%
    • Stargazers count: 0.933%
rubygems.org: mime-types

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. Version 3.0 is a major release that requires Ruby 2.0 compatibility and removes deprecated functions. The columnar registry format introduced in 2.6 has been made the primary format; the registry data has been extracted from this library and put into [mime-types-data][data]. Additionally, mime-types is now licensed exclusively under the MIT licence and there is a code of conduct in effect. There are a number of other smaller changes described in the History file.

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Documentation: http://www.rubydoc.info/gems/mime-types/
  • Licenses: MIT
  • Latest release: 3.7.0 (published 10 months ago)
  • Last Synced: 2026-03-02T06:02:49.935Z (1 day ago)
  • Versions: 49
  • Dependent Packages: 1,210
  • Dependent Repositories: 670,993
  • Downloads: 876,119,340 Total
  • Docker Downloads: 2,006,829,051
  • Rankings:
    • Downloads: 0.015%
    • Dependent repos count: 0.022%
    • Dependent packages count: 0.042%
    • Docker downloads count: 0.066%
    • Average: 0.925%
    • Forks count: 2.245%
    • Stargazers count: 3.157%
  • Maintainers (1)
debian-11: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Documentation: https://packages.debian.org/bullseye/ruby-mime-types
  • Licenses:
  • Latest release: 3.3.1-1 (published 21 days ago)
  • Last Synced: 2026-02-13T08:22:07.884Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-24.04: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Licenses:
  • Latest release: 3.5.2-1 (published 26 days ago)
  • Last Synced: 2026-02-05T07:42:56.101Z (26 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-24.10: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Licenses:
  • Latest release: 3.5.2-1 (published 23 days ago)
  • Last Synced: 2026-02-08T06:35:17.148Z (23 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-23.10: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Licenses:
  • Latest release: 3.4.1-2 (published 22 days ago)
  • Last Synced: 2026-02-09T20:07:22.090Z (22 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
debian-10: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Documentation: https://packages.debian.org/buster/ruby-mime-types
  • Licenses:
  • Latest release: 3.2.2-1 (published 20 days ago)
  • Last Synced: 2026-02-13T04:22:55.123Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-20.04: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Licenses:
  • Latest release: 3.3.1-1 (published 18 days ago)
  • Last Synced: 2026-02-13T07:17:39.349Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-13: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Documentation: https://packages.debian.org/trixie/ruby-mime-types
  • Licenses:
  • Latest release: 3.6.0-1 (published 19 days ago)
  • Last Synced: 2026-02-13T13:17:28.280Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-12: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Documentation: https://packages.debian.org/bookworm/ruby-mime-types
  • Licenses:
  • Latest release: 3.4.1-2 (published 19 days ago)
  • Last Synced: 2026-02-12T23:35:03.628Z (19 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-23.04: ruby-mime-types

  • Homepage: https://github.com/mime-types/ruby-mime-types/
  • Licenses:
  • Latest release: 3.4.1-2 (published 21 days ago)
  • Last Synced: 2026-02-11T00:29:48.824Z (21 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • ruby/setup-ruby v1 composite
Gemfile rubygems
  • debug >= 0
.github/workflows/publish-gem.yml actions
  • actions/checkout 8e8c483db84b4bee98b60c0593521ed34d9990e8 composite
  • ruby/setup-ruby d354de180d0c9e813cfddfcbdc079945d4be589b composite
  • rubygems/release-gem 1c162a739e8b4cb21a676e97b087e8268d8fc40b composite
  • step-security/harden-runner 20cf305ff2072d973412fa9b1e3a4f227bda3c76 composite
.github/workflows/reviewdog.yml actions
  • actions/checkout 8e8c483db84b4bee98b60c0593521ed34d9990e8 composite
  • reviewdog/action-actionlint 83e4ed25b168066ad8f62f5afbb29ebd8641d982 composite
  • reviewdog/action-typos d5eb1bbcd1b3bfde596f6eeb470322727862fe98 composite
  • step-security/harden-runner 20cf305ff2072d973412fa9b1e3a4f227bda3c76 composite
.github/workflows/zizmor.yml actions
  • actions/checkout 8e8c483db84b4bee98b60c0593521ed34d9990e8 composite
  • step-security/harden-runner 20cf305ff2072d973412fa9b1e3a4f227bda3c76 composite
  • zizmorcore/zizmor-action e639db99335bc9038abc0e066dfcd72e23d26fb4 composite
mime-types.gemspec rubygems
.github/workflows/dco-check.yml actions
  • KineticCafe/actions-dco cd9508e5ae82413fbd74b20af21551db0ea3eb78 composite
  • step-security/harden-runner 20cf305ff2072d973412fa9b1e3a4f227bda3c76 composite
.github/workflows/dependency-review.yml actions
  • actions/checkout 8e8c483db84b4bee98b60c0593521ed34d9990e8 composite
  • actions/dependency-review-action 3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 composite
  • step-security/harden-runner 20cf305ff2072d973412fa9b1e3a4f227bda3c76 composite
.github/workflows/publish-docs.yml actions
  • actions/checkout 8e8c483db84b4bee98b60c0593521ed34d9990e8 composite
  • actions/deploy-pages d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e composite
  • actions/upload-pages-artifact 7b1f4a764d45c48632c6b24a0339c27f5614fb0b composite
  • ruby/setup-ruby d354de180d0c9e813cfddfcbdc079945d4be589b composite
  • step-security/harden-runner 20cf305ff2072d973412fa9b1e3a4f227bda3c76 composite

Score: 32.43435807632631