A summary of data about the Ruby ecosystem.

https://github.com/mimemagicrb/mimemagic

Mime type detection in ruby via file extension or file content
https://github.com/mimemagicrb/mimemagic

Keywords from Contributors

activejob activerecord mvc rubygems crash-reporting sinatra rspec static-code-analysis code-formatter rubocop

Last synced: about 18 hours ago
JSON representation

Repository metadata

Mime type detection in ruby via file extension or file content

README.md

MimeMagic is a library to detect the mime type of a file by extension or by content. It uses the mime database
provided by freedesktop.org (see http://freedesktop.org/wiki/Software/shared-mime-info/).

Gem Version

Dependencies

You will require a copy of the Freedesktop.org shared-mime-info database to be available. If you're on Linux,
it's probably available via your package manager, and will probably be in the location it's being looked for
when the gem is installed.

macOS users can install the database via Homebrew with brew install shared-mime-info.

Should you be unable to use a package manager you can obtain a copy of the needed file by extracting it from
the Debian package. This process will also work on a Windows machine.

  1. Download the package from https://packages.debian.org/sid/amd64/shared-mime-info/download
  2. Ensure the command line version of 7-Zip is installed
  3. 7z x -so shared-mime-info_2.0-1_amd64.deb data.tar | 7z e -sidata.tar "./usr/share/mime/packages/freedesktop.org.xml"

Place the file freedesktop.org.xml in an appropriate location, and then set the environment variable
FREEDESKTOP_MIME_TYPES_PATH to that path. Once that has been done the gem should install successfully. Please
note that the gem will depend upon the file remaining in that location at run time.

Usage

require 'mimemagic'
MimeMagic.by_extension('html').text?
MimeMagic.by_extension('.html').child_of? 'text/plain'
MimeMagic.by_path('filename.txt')
MimeMagic.by_magic(File.open('test.html'))
# etc...

You can add your own magic with MimeMagic.add.

API

http://www.rubydoc.info/github/mimemagicrb/mimemagic

Tests

$ bundle install

$ bundle exec rake test

Authors

LICENSE

{file:LICENSE MIT}


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 3 days ago

Total Commits: 143
Total Committers: 32
Avg Commits per committer: 4.469
Development Distribution Score (DDS): 0.594

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
Daniel Mendler m****l@d****e 58
Jon Wood j****n@b****t 29
Daniel Mendler m****d@s****e 5
minad d****r@w****e 5
Janko Marohnić j****c@g****m 4
Olle Jonsson o****n@g****m 4
Ian Young i****f@g****m 3
Jun Aruga j****a@r****m 3
Rob Cherry r****y@r****m 3
Ali Ismayilov a****i@i****o 2
Kenichi Kamiya k****1@g****m 2
Oleg o****g@k****a 2
Stephen Pike s****e@s****t 2
wbond w****l@w****t 2
f****t@p****m 2
Jacques Crocker r****i@g****m 1
Andrew Haines a****w@h****z 1
Christopher Pfohl C****l@g****m 1
Cédric Boutillier b****l@d****g 1
Gurusamy Sarathy g****2@g****m 1
Jared Beck j****d@j****m 1
Jordan Thoms j****n@t****z 1
Justin Coyne j****e@j****m 1
Larry Kyrala l****a@g****m 1
Masataka Pocke Kuwabara k****a@p****e 1
Mathieu Mahé m****e@g****m 1
Nick LaMuro n****o@g****m 1
Rosa Gutierrez r****a@r****t 1
Scott Bronson b****t@r****m 1
Stanisław Pitucha s****a@e****m 1
and 2 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 9 days ago

Total issues: 57
Total pull requests: 50
Average time to close issues: 7 months
Average time to close pull requests: 2 months
Total issue authors: 56
Total pull request authors: 36
Average comments per issue: 3.3
Average comments per pull request: 2.12
Merged pull request: 20
Bot issues: 0
Bot pull requests: 0

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

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

Top Issue Authors

  • doriantaylor (2)
  • toastal (1)
  • gmcquistin (1)
  • bjnord (1)
  • junaruga (1)
  • HoneyryderChuck (1)
  • errm (1)
  • gr8bit (1)
  • akiko-pusu (1)
  • keeguon (1)
  • elliotcm (1)
  • makyen (1)
  • nflorentin (1)
  • codeface (1)
  • Silex (1)

Top Pull Request Authors

  • olleolleolle (5)
  • haines (3)
  • junaruga (3)
  • GBH (2)
  • raphox (2)
  • aliismayilov (2)
  • joshheinrichs-shopify (2)
  • dillonwelch (2)
  • benkoshy (2)
  • kachick (2)
  • epitron (2)
  • brlanier (1)
  • coldnebo (1)
  • atambo (1)
  • jcoyne (1)

Top Issue Labels

Top Pull Request Labels


Package metadata

gem.coop: mimemagic

Fast mime detection by extension or content (Uses freedesktop.org.xml shared-mime-info database)

  • Homepage: https://github.com/mimemagicrb/mimemagic
  • Documentation: http://www.rubydoc.info/gems/mimemagic/
  • Licenses: MIT
  • Latest release: 0.4.3 (published almost 5 years ago)
  • Last Synced: 2026-03-01T13:33:04.172Z (2 days ago)
  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 186,786,360 Total
  • Docker Downloads: 79,669,517
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Downloads: 0.128%
    • Average: 0.172%
    • Docker downloads count: 0.561%
  • Maintainers (2)
rubygems.org: mimemagic

Fast mime detection by extension or content (Uses freedesktop.org.xml shared-mime-info database)

  • Homepage: https://github.com/mimemagicrb/mimemagic
  • Documentation: http://www.rubydoc.info/gems/mimemagic/
  • Licenses: MIT
  • Latest release: 0.4.3 (published almost 5 years ago)
  • Last Synced: 2026-03-01T12:01:42.556Z (2 days ago)
  • Versions: 7
  • Dependent Packages: 194
  • Dependent Repositories: 210,567
  • Downloads: 186,785,050 Total
  • Docker Downloads: 79,669,517
  • Rankings:
    • Dependent repos count: 0.095%
    • Downloads: 0.104%
    • Dependent packages count: 0.193%
    • Docker downloads count: 0.766%
    • Average: 0.87%
    • Forks count: 1.275%
    • Stargazers count: 2.787%
  • Maintainers (2)
proxy.golang.org: github.com/mimemagicrb/mimemagic

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/mimemagicrb/mimemagic#section-documentation
  • Licenses: mit
  • Latest release: v0.4.3 (published almost 5 years ago)
  • Last Synced: 2026-02-27T22:03:16.178Z (4 days ago)
  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Forks count: 1.39%
    • Stargazers count: 2.831%
    • Average: 6.15%
    • Dependent packages count: 9.576%
    • Dependent repos count: 10.802%
ubuntu-24.04: ruby-mimemagic

  • Homepage: https://github.com/mimemagicrb/mimemagic
  • Licenses:
  • Latest release: 0.4.3-1build2 (published 25 days ago)
  • Last Synced: 2026-02-06T15:34:01.337Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-24.10: ruby-mimemagic

  • Homepage: https://github.com/mimemagicrb/mimemagic
  • Licenses:
  • Latest release: 0.4.3-1build3 (published 22 days ago)
  • Last Synced: 2026-02-09T16:56:04.995Z (22 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
debian-13: ruby-mimemagic

  • Homepage: https://github.com/mimemagicrb/mimemagic
  • Documentation: https://packages.debian.org/trixie/ruby-mimemagic
  • Licenses:
  • Latest release: 0.4.3-2 (published 19 days ago)
  • Last Synced: 2026-02-13T13:17:28.717Z (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
  • github-markup >= 0
  • redcarpet >= 0
  • yard >= 0
mimemagic.gemspec rubygems
  • minitest ~> 5.14 development
  • nokogiri ~> 1
  • rake >= 0

Score: 29.682489859553506