A summary of data about the Ruby ecosystem.

https://github.com/discourse/mini_mime

minimal mime type library
https://github.com/discourse/mini_mime

Keywords

rubygem

Keywords from Contributors

activerecord activejob mvc rubygems rack rubocop gem code-formatter static-code-analysis rspec

Last synced: about 19 hours ago
JSON representation

Repository metadata

minimal mime type library

README.md

MiniMime

Minimal mime type implementation for use with the mail and rest-client gem.

Installation

Add this line to your application's Gemfile:

gem 'mini_mime'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mini_mime

Usage

require 'mini_mime'

MiniMime.lookup_by_filename("a.txt").content_type
# => "text/plain"

MiniMime.lookup_by_extension("txt").content_type
# => "text/plain"

MiniMime.lookup_by_content_type("text/plain").extension
# => "txt"

MiniMime.lookup_by_content_type("text/plain").binary?
# => false

Configuration

If you'd like to add your own mime types, try using custom database files:

MiniMime::Configuration.ext_db_path = "path_to_file_extension_db"
MiniMime::Configuration.content_type_db_path = "path_to_content_type_db"

Check out the default databases for proper formatting and structure hints.

Performance

MiniMime is optimised to minimize memory usage. It keeps a cache of 100 mime type lookups (and 100 misses). There are benchmarks in the bench directory

Memory stats for requiring mime/types/columnar
Total allocated: 8712144 bytes (98242 objects)
Total retained:  3372545 bytes (33599 objects)

Memory stats for requiring mini_mime
Total allocated: 42625 bytes (369 objects)
Total retained:  8992 bytes (72 objects)
Warming up --------------------------------------
cached content_type lookup MiniMime
                        85.109k i/100ms
content_type lookup MIME::Types
                        17.879k i/100ms
Calculating -------------------------------------
cached content_type lookup MiniMime
                          1.105M (± 4.1%) i/s -      5.532M in   5.014895s
content_type lookup MIME::Types
                        193.528k (± 7.1%) i/s -    965.466k in   5.013925s
Warming up --------------------------------------
uncached content_type lookup MiniMime
                         1.410k i/100ms
content_type lookup MIME::Types
                        18.012k i/100ms
Calculating -------------------------------------
uncached content_type lookup MiniMime
                         14.689k (± 4.2%) i/s -     73.320k in   5.000779s
content_type lookup MIME::Types
                        193.459k (± 6.9%) i/s -    972.648k in   5.050731s

As a general guideline, cached lookups are 6x faster than MIME::Types equivalent. Uncached lookups are 10x slower.

Note: It was run on macOS 10.14.2, and versions of Ruby and gems are below.

  • Ruby 3.1.0
  • mini_mime (1.0.1)
  • mime-types (3.2.2)
  • mime-types-data (3.2018.0812)

Development

MiniMime uses the officially maintained list of mime types at mime-types-data repo to build the internal database.

To update the database run:

bundle exec rake rebuild_db

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/discourse/mini_mime. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 4 days ago

Total Commits: 71
Total Committers: 26
Avg Commits per committer: 2.731
Development Distribution Score (DDS): 0.648

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Sam s****n@g****m 25
Oliver Peate o****i@s****m 5
Jason Frey f****9@g****m 4
Gannon McGibbon g****n@g****m 3
Jean Boussier j****r@g****m 3
pavel p****y@e****z 3
Ryan Bigg g****t@r****m 2
Aqualon a****n@a****e 2
Guo Xiang Tan t****d@h****m 2
Ilmari Karonen i****n@r****m 2
Jarek Radosz j****z@g****m 2
github-actions[bot] 4****] 2
github-actions a****s@g****m 2
Natalie Tay n****y@g****m 2
Jericho g****s@a****g 1
Alessandro Rodi a****i@r****h 1
David Taylor d****d@t****m 1
Espartaco Palma e****a@g****m 1
Igor Victor g****a@y****u 1
Janko Marohnić j****c@g****m 1
Jeremy Daer j****r@g****m 1
Masafumi Koba 4****s 1
Osama Sayegh a****0@g****m 1
Peter Goldstein p****n@g****m 1
Tim Craft m****l@t****m 1
ohbarye o****e@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 10 days ago

Total issues: 18
Total pull requests: 45
Average time to close issues: 11 months
Average time to close pull requests: 19 days
Total issue authors: 13
Total pull request authors: 26
Average comments per issue: 3.44
Average comments per pull request: 2.04
Merged pull request: 35
Bot issues: 0
Bot pull requests: 4

Past year issues: 1
Past year pull requests: 3
Past year average time to close issues: N/A
Past year average time to close pull requests: 1 day
Past year issue authors: 1
Past year pull request authors: 1
Past year average comments per issue: 0.0
Past year average comments per pull request: 1.33
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/discourse/mini_mime

Top Issue Authors

  • gmcgibbon (3)
  • Fryguy (3)
  • halostatue (2)
  • envygeeks (1)
  • martinvonwittich (1)
  • toshimaru (1)
  • ikaronen-relex (1)
  • bonniesimon (1)
  • paulRbr (1)
  • kangguru (1)
  • pjmartorell (1)
  • wtn (1)
  • ohbarye (1)

Top Pull Request Authors

  • ahorek (6)
  • github-actions[bot] (4)
  • Fryguy (3)
  • casperisfine (3)
  • SamSaffron (3)
  • nattsw (3)
  • ikaronen-relex (2)
  • odlp (2)
  • CvX (2)
  • aisha131996 (2)
  • radar (1)
  • gogainda (1)
  • attritionorg (1)
  • coorasse (1)
  • ybiquitous (1)

Top Issue Labels

Top Pull Request Labels


Package metadata

gem.coop: mini_mime

A minimal mime type library

  • Homepage: https://github.com/discourse/mini_mime
  • Documentation: http://www.rubydoc.info/gems/mini_mime/
  • Licenses: MIT
  • Latest release: 1.1.5 (published over 2 years ago)
  • Last Synced: 2026-03-01T08:32:26.522Z (2 days ago)
  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 783,415,893 Total
  • Docker Downloads: 2,183,871,154
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.017%
    • Downloads: 0.018%
    • Docker downloads count: 0.05%
  • Maintainers (2)
rubygems.org: mini_mime

A minimal mime type library

  • Homepage: https://github.com/discourse/mini_mime
  • Documentation: http://www.rubydoc.info/gems/mini_mime/
  • Licenses: MIT
  • Latest release: 1.1.5 (published over 2 years ago)
  • Last Synced: 2026-03-01T05:02:25.859Z (2 days ago)
  • Versions: 14
  • Dependent Packages: 36
  • Dependent Repositories: 364,354
  • Downloads: 783,388,518 Total
  • Docker Downloads: 2,183,871,154
  • Rankings:
    • Downloads: 0.026%
    • Dependent repos count: 0.055%
    • Docker downloads count: 0.129%
    • Dependent packages count: 0.728%
    • Average: 1.873%
    • Forks count: 4.72%
    • Stargazers count: 5.584%
  • Maintainers (2)
proxy.golang.org: github.com/discourse/mini_mime

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/discourse/mini_mime#section-documentation
  • Licenses: mit
  • Latest release: v1.1.5 (published over 2 years ago)
  • Last Synced: 2026-02-27T09:03:04.371Z (4 days ago)
  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Forks count: 4.123%
    • Stargazers count: 4.639%
    • Average: 7.285%
    • Dependent packages count: 9.576%
    • Dependent repos count: 10.802%
ubuntu-23.10: ruby-mini-mime

  • Homepage: https://github.com/discourse/mini_mime
  • Licenses:
  • Latest release: 1.1.1-2 (published 17 days ago)
  • Last Synced: 2026-02-13T18:25:36.593Z (17 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-mini-mime

  • Homepage: https://github.com/discourse/mini_mime
  • Licenses:
  • Latest release: 1.1.5-1 (published 25 days ago)
  • Last Synced: 2026-02-06T15:34:07.282Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-24.10: ruby-mini-mime

  • Homepage: https://github.com/discourse/mini_mime
  • Licenses:
  • Latest release: 1.1.5-1 (published 22 days ago)
  • Last Synced: 2026-02-09T16:56:35.672Z (22 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
debian-11: ruby-mini-mime

  • Homepage: https://github.com/discourse/mini_mime
  • Documentation: https://packages.debian.org/bullseye/ruby-mini-mime
  • Licenses:
  • Latest release: 1.0.2-1 (published 20 days ago)
  • Last Synced: 2026-02-13T08:22:12.400Z (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-10: ruby-mini-mime

  • Homepage: https://github.com/discourse/mini_mime
  • Documentation: https://packages.debian.org/buster/ruby-mini-mime
  • Licenses:
  • Latest release: 1.0.1-1 (published 20 days ago)
  • Last Synced: 2026-02-13T04:22:56.761Z (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-mini-mime

  • Homepage: https://github.com/discourse/mini_mime
  • Licenses:
  • Latest release: 1.0.1-1 (published 18 days ago)
  • Last Synced: 2026-02-13T07:17:43.343Z (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-22.04: ruby-mini-mime

  • Homepage: https://github.com/discourse/mini_mime
  • Licenses:
  • Latest release: 1.1.1-2 (published 18 days ago)
  • Last Synced: 2026-02-13T13:20:32.358Z (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-23.04: ruby-mini-mime

  • Homepage: https://github.com/discourse/mini_mime
  • Licenses:
  • Latest release: 1.1.1-2 (published 20 days ago)
  • Last Synced: 2026-02-11T06:43:22.187Z (20 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-mini-mime

  • Homepage: https://github.com/discourse/mini_mime
  • Documentation: https://packages.debian.org/bookworm/ruby-mini-mime
  • Licenses:
  • Latest release: 1.1.1-2 (published 18 days ago)
  • Last Synced: 2026-02-12T23:35:07.372Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
debian-13: ruby-mini-mime

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

Dependencies

Gemfile rubygems
  • benchmark-ips >= 0
  • memory_profiler >= 0
mini_mime.gemspec rubygems
  • bundler >= 0 development
  • minitest >= 0 development
  • rake >= 0 development
  • rubocop >= 0 development
  • rubocop-discourse >= 0 development
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • ruby/setup-ruby v1 composite
.github/workflows/db.yml actions
  • actions/checkout v3 composite
  • ruby/setup-ruby v1 composite

Score: 30.41617536572045