Skip to content

Instantly share code, notes, and snippets.

@sunnygleason
Created January 11, 2012 21:30
Show Gist options
  • Save sunnygleason/1596855 to your computer and use it in GitHub Desktop.
Save sunnygleason/1596855 to your computer and use it in GitHub Desktop.
File Extensions by MIME Type
require 'mime/types'
ARGV.each do |mime_type|
mimes = MIME::Types[mime_type]
exts = []
mimes && mimes.each do |mime|
mime.extensions.each { |x| exts << x }
end
puts "#{mime_type} extensions : #{exts.join(',')}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment