From 3b845b29d085e39678e41cb7cd9a34614353f52d Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 13 Dec 2016 18:39:26 +1100 Subject: [PATCH] Initial commit --- .gitignore | 9 + .travis.yml | 5 + CODE_OF_CONDUCT.md | 74 +++ Gemfile | 4 + LICENSE.txt | 21 + README.md | 38 ++ Rakefile | 65 +++ bin/console | 14 + bin/setup | 8 + lib/db/mime.db | 1162 ++++++++++++++++++++++++++++++++++++++ lib/mini_mime.rb | 90 +++ lib/mini_mime/version.rb | 3 + mini_mime.gemspec | 37 ++ test/mini_mime_test.rb | 23 + test/test_helper.rb | 4 + 15 files changed, 1557 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 Gemfile create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 Rakefile create mode 100755 bin/console create mode 100755 bin/setup create mode 100644 lib/db/mime.db create mode 100644 lib/mini_mime.rb create mode 100644 lib/mini_mime/version.rb create mode 100644 mini_mime.gemspec create mode 100644 test/mini_mime_test.rb create mode 100644 test/test_helper.rb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0cb6eeb --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/.bundle/ +/.yardoc +/Gemfile.lock +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..068065b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +sudo: false +language: ruby +rvm: + - 2.3.2 +before_install: gem install bundler -v 1.13.6 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..951cdde --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at sam.saffron@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..a856538 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in mini_mime.gemspec +gemspec diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..109b204 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 TODO: Write your name + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c07d75 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# MiniMime + +Minimal mime type implementation for use with the mail and rest-client gem + +## Installation + +Add this line to your application's Gemfile: + +```ruby +gem 'mini_mime' +``` + +And then execute: + + $ bundle + +Or install it yourself as: + + $ gem install mini_mime + +## Usage + + +## Development + +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](https://rubygems.org). + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mini_mime. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. + + +## License + +The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..f8e2e01 --- /dev/null +++ b/Rakefile @@ -0,0 +1,65 @@ +require "bundler/gem_tasks" +require "rake/testtask" + +Rake::TestTask.new(:test) do |t| + t.libs << "test" + t.libs << "lib" + t.test_files = FileList['test/**/*_test.rb'] +end + +task :default => :test + +def pad(array) + max = [] + array.each do |row| + i = 0 + row.each do |col| + max[i] = [max[i] || 0, col.length].max + i += 1 + end + end + + array.each do |row| + i = 0 + row.each do |col| + col << " " * (max[i] - col.length) + i += 1 + end + end + +end + +desc "generate mime type database" +task :rebuild_db do + puts "Generating mime type DB" + require 'mime/types' + index = {} + + MIME::Types.each do |type| + type.extensions.each {|ext| (index[ext] ||= []) << type} + end + + index.each do |k,list| + list.sort!{|a,b| a.priority_compare(b)} + end + + buffer = [] + + index.each do |ext, list| + first = list.first + buffer << [ext.dup, first.content_type.dup, first.encoding.dup] + end + + buffer.sort!{|a,b| a[0] <=> b[0]} + + pad(buffer) + + File.open("lib/db/mime.db", File::CREAT|File::TRUNC|File::RDWR) do |f| + buffer.each do |row| + f.write "#{row[0]} #{row[1]} #{row[2]}\n" + end + end + + puts "#{buffer.count} rows written to lib/db/mime.db" + +end diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..74594f4 --- /dev/null +++ b/bin/console @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +require "bundler/setup" +require "mini_mime" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +# (If you use this, don't forget to add pry to your Gemfile!) +# require "pry" +# Pry.start + +require "irb" +IRB.start diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..dce67d8 --- /dev/null +++ b/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/lib/db/mime.db b/lib/db/mime.db new file mode 100644 index 0000000..c1e6ddb --- /dev/null +++ b/lib/db/mime.db @@ -0,0 +1,1162 @@ +123 application/vnd.lotus-1-2-3 base64 +3dml text/vnd.in3d.3dml quoted-printable +3ds image/x-3ds base64 +3fr image/x-hasselblad-3fr base64 +3g2 video/3gpp2 base64 +3gp video/3gpp base64 +3gpp video/3gpp base64 +3gpp2 video/3gpp2 base64 +7z application/x-7z-compressed base64 +@dir application/x-director base64 +@dxr application/x-director base64 +Z application/x-compress base64 +aab application/x-authorware-bin base64 +aac audio/x-aac base64 +aam application/x-authorware-map base64 +aas application/x-authorware-seg base64 +abw application/x-abiword base64 +ac application/pkix-attr-cert base64 +acc application/vnd.americandynamics.acc base64 +ace application/x-ace-compressed base64 +acu application/vnd.acucobol base64 +acutc application/vnd.acucorp 7bit +adp audio/adpcm base64 +aep application/vnd.audiograph base64 +afm application/x-font-type1 base64 +afp application/vnd.ibm.modcap base64 +ahead application/vnd.ahead.space base64 +ai application/postscript 8bit +aif audio/x-aiff base64 +aifc audio/x-aiff base64 +aiff audio/x-aiff base64 +air application/vnd.adobe.air-application-installer-package+zip base64 +ait application/vnd.dvb.ait base64 +ami application/vnd.amiga.ami base64 +amr audio/AMR base64 +ani application/octet-stream base64 +apk application/vnd.android.package-archive base64 +appcache text/cache-manifest quoted-printable +application application/x-ms-application base64 +apr application/vnd.lotus-approach base64 +arc application/x-freearc base64 +asc application/pgp-signature base64 +asf application/vnd.ms-asf base64 +asm text/x-asm quoted-printable +aso application/vnd.accpac.simply.aso base64 +asx video/x-ms-asf base64 +atc application/vnd.acucorp 7bit +atom application/atom+xml 8bit +atomcat application/atomcat+xml 8bit +atomsvc application/atomsvc+xml 8bit +atx application/vnd.antix.game-component base64 +au audio/basic base64 +avi video/x-msvideo base64 +aw application/applixware base64 +awb audio/AMR-WB base64 +azf application/vnd.airzip.filesecure.azf base64 +azs application/vnd.airzip.filesecure.azs base64 +azw application/vnd.amazon.ebook base64 +bat application/x-msdos-program base64 +bck application/VMSBACKUP base64 +bcpio application/x-bcpio base64 +bdf application/x-font-bdf base64 +bdm application/vnd.syncml.dm+wbxml base64 +bed application/vnd.realvnc.bed base64 +bh2 application/vnd.fujitsu.oasysprs base64 +bin application/octet-stream base64 +bkm application/vnd.nervana base64 +blb application/x-blorb base64 +bleep application/bleeper base64 +blorb application/x-blorb base64 +bmi application/vnd.bmi base64 +bmp image/bmp base64 +book application/vnd.framemaker base64 +box application/vnd.previewsystems.box base64 +boz application/x-bzip2 base64 +bpd application/vnd.hbci base64 +bpk application/octet-stream base64 +btif image/prs.btif base64 +bz application/x-bzip base64 +bz2 application/x-bzip2 base64 +c text/plain quoted-printable +c11amc application/vnd.cluetrust.cartomobile-config base64 +c11amz application/vnd.cluetrust.cartomobile-config-pkg base64 +c4d application/vnd.clonk.c4group base64 +c4f application/vnd.clonk.c4group base64 +c4g application/vnd.clonk.c4group base64 +c4p application/vnd.clonk.c4group base64 +c4u application/vnd.clonk.c4group base64 +cab application/vnd.ms-cab-compressed base64 +caf audio/x-caf base64 +cap application/vnd.tcpdump.pcap base64 +car application/vnd.curl.car base64 +cat application/vnd.ms-pki.seccat base64 +cb7 application/x-cbr base64 +cba application/x-cbr base64 +cbr application/x-cbr base64 +cbt application/x-cbr base64 +cbz application/x-cbr base64 +cc text/plain quoted-printable +ccc text/vnd.net2phone.commcenter.command quoted-printable +cct application/x-director base64 +ccxml application/ccxml+xml base64 +cdbcmsg application/vnd.contact.cmsg base64 +cdf application/netcdf base64 +cdkey application/vnd.mediastation.cdkey base64 +cdmia application/cdmi-capability base64 +cdmic application/cdmi-container base64 +cdmid application/cdmi-domain base64 +cdmio application/cdmi-object base64 +cdmiq application/cdmi-queue base64 +cdx chemical/x-cdx base64 +cdxml application/vnd.chemdraw+xml base64 +cdy application/vnd.cinderella base64 +cer application/pkix-cert base64 +cfs application/x-cfs-compressed base64 +cgm image/cgm base64 +chat application/x-chat base64 +chm application/vnd.ms-htmlhelp base64 +chrt application/vnd.kde.kchart base64 +cif chemical/x-cif base64 +cii application/vnd.anser-web-certificate-issue-initiation base64 +cil application/vnd.ms-artgalry base64 +cla application/vnd.claymore base64 +class application/java-vm base64 +clkk application/vnd.crick.clicker.keyboard base64 +clkp application/vnd.crick.clicker.palette base64 +clkt application/vnd.crick.clicker.template base64 +clkw application/vnd.crick.clicker.wordbank base64 +clkx application/vnd.crick.clicker base64 +clp application/x-msclip base64 +cmc application/vnd.cosmocaller base64 +cmd application/x-msdos-program base64 +cmdf chemical/x-cmdf base64 +cml chemical/x-cml base64 +cmp application/vnd.yellowriver-custom-menu base64 +cmx image/x-cmx base64 +cod application/vnd.rim.cod base64 +coffee text/x-coffescript 8bit +com application/x-msdos-program base64 +conf text/plain quoted-printable +cpio application/x-cpio base64 +cpp text/plain quoted-printable +cpt application/mac-compactpro base64 +crd application/x-mscardfile base64 +crl application/pkix-crl base64 +crt application/x-x509-ca-cert base64 +crx application/x-chrome-extension base64 +cryptonote application/vnd.rig.cryptonote base64 +csh application/x-csh 8bit +csm application/x-cu-seeme base64 +csml chemical/x-csml base64 +csp application/vnd.commonspace base64 +css text/css 8bit +cst application/x-director base64 +csv text/comma-separated-values 8bit +cu application/cu-seeme base64 +curl application/vnd.curl base64 +cw application/prs.cww base64 +cww application/prs.cww base64 +cxt application/x-director base64 +cxx text/x-c quoted-printable +dae model/vnd.collada+xml base64 +daf application/vnd.Mobius.DAF base64 +dart application/vnd.dart base64 +dat text/plain quoted-printable +dataless application/vnd.fdsn.seed base64 +davmount application/davmount+xml base64 +dbk application/docbook+xml base64 +dcm application/dicom base64 +dcr application/x-director base64 +dcurl text/vnd.curl.dcurl quoted-printable +dd2 application/vnd.oma.dd2+xml base64 +ddd application/vnd.fujixerox.ddd base64 +deb application/x-debian-package base64 +def text/plain quoted-printable +deploy application/octet-stream base64 +der application/x-x509-ca-cert base64 +dfac application/vnd.dreamfactory base64 +dgc application/x-dgc-compressed base64 +dgn image/vnd.dgn base64 +dic text/x-c quoted-printable +dir application/x-director base64 +dis application/vnd.Mobius.DIS base64 +dist application/octet-stream base64 +distz application/octet-stream base64 +djv image/vnd.djvu base64 +djvu image/vnd.djvu base64 +dl video/dl base64 +dll application/octet-stream base64 +dmg application/x-apple-diskimage base64 +dmp application/vnd.tcpdump.pcap base64 +dms application/octet-stream base64 +dna application/vnd.dna base64 +doc application/msword base64 +docm application/vnd.ms-word.document.macroEnabled.12 base64 +docx application/vnd.openxmlformats-officedocument.wordprocessingml.document base64 +dot application/msword base64 +dotm application/vnd.ms-word.template.macroEnabled.12 base64 +dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template base64 +dp application/vnd.osgi.dp base64 +dpg application/vnd.dpgraph base64 +dra audio/vnd.dra base64 +dsc text/prs.lines.tag quoted-printable +dssc application/dssc+der base64 +dtb application/x-dtbook+xml base64 +dtd application/xml-dtd 8bit +dts audio/vnd.dts base64 +dtshd audio/vnd.dts.hd base64 +dump application/octet-stream base64 +dv video/DV base64 +dvb video/vnd.dvb.file base64 +dvi application/x-dvi base64 +dwf drawing/dwf base64 +dwg image/vnd.dwg base64 +dxf image/vnd.dxf base64 +dxp application/vnd.spotfire.dxp base64 +dxr application/x-director base64 +dylib application/octet-stream base64 +ecelp4800 audio/vnd.nuera.ecelp4800 base64 +ecelp7470 audio/vnd.nuera.ecelp7470 base64 +ecelp9600 audio/vnd.nuera.ecelp9600 base64 +ecma application/ecmascript base64 +edm application/vnd.novadigm.EDM base64 +edx application/vnd.novadigm.EDX base64 +efif application/vnd.picsel base64 +ei6 application/vnd.pg.osasli base64 +elc application/octet-stream base64 +emf application/x-msmetafile base64 +eml message/rfc822 8bit +emm application/vnd.ibm.electronic-media base64 +emma application/emma+xml base64 +emz application/x-msmetafile base64 +ent application/vnd.nervana base64 +entity application/vnd.nervana base64 +eol audio/vnd.digital-winds 7bit +eot application/vnd.ms-fontobject base64 +eps application/postscript 8bit +epub application/epub+zip base64 +es3 application/vnd.eszigno3+xml base64 +esa application/vnd.osgi.subsystem base64 +esf application/vnd.epson.esf base64 +et3 application/vnd.eszigno3+xml base64 +etx text/x-setext quoted-printable +eva application/x-eva base64 +evc audio/EVRC base64 +evy application/x-envoy base64 +exe application/octet-stream base64 +exi application/exi base64 +ext application/vnd.novadigm.EXT base64 +ez application/andrew-inset base64 +ez2 application/vnd.ezpix-album base64 +ez3 application/vnd.ezpix-package base64 +f text/x-fortran quoted-printable +f4a audio/mp4 base64 +f4b audio/mp4 base64 +f4p video/mp4 base64 +f4v video/mp4 base64 +f77 text/x-fortran quoted-printable +f90 text/x-fortran quoted-printable +fb application/vnd.framemaker base64 +fbdoc application/vnd.framemaker base64 +fbs image/vnd.fastbidsheet base64 +fcdt application/vnd.adobe.formscentral.fcdt base64 +fcs application/vnd.isac.fcs base64 +fdf application/vnd.fdf base64 +fe_launch application/vnd.denovo.fcselayout-link base64 +fg5 application/vnd.fujitsu.oasysgp base64 +fgd application/x-director base64 +fh image/x-freehand base64 +fh4 image/x-freehand base64 +fh5 image/x-freehand base64 +fh7 image/x-freehand base64 +fhc image/x-freehand base64 +fig application/x-xfig base64 +flac audio/x-flac base64 +fli video/x-fli base64 +flo application/vnd.micrografx.flo base64 +flv video/x-flv base64 +flw application/vnd.kde.kivio base64 +flx text/vnd.fmi.flexstor quoted-printable +fly text/vnd.fly quoted-printable +fm application/vnd.framemaker base64 +fnc application/vnd.frogans.fnc base64 +for text/x-fortran quoted-printable +fpx image/vnd.fpx base64 +frame application/vnd.framemaker base64 +frm application/vnd.framemaker base64 +fsc application/vnd.fsc.weblaunch 7bit +fst image/vnd.fst base64 +ftc application/vnd.fluxtime.clip base64 +fti application/vnd.anser-web-funds-transfer-initiation base64 +fvt video/vnd.fvt base64 +fxp application/vnd.adobe.fxp base64 +fxpl application/vnd.adobe.fxp base64 +fzs application/vnd.fuzzysheet base64 +g2w application/vnd.geoplan base64 +g3 image/g3fax base64 +g3w application/vnd.geospace base64 +gac application/vnd.groove-account base64 +gam application/x-tads base64 +gbr application/rpki-ghostbusters base64 +gca application/x-gca-compressed base64 +gdl model/vnd.gdl base64 +geo application/vnd.dynageo base64 +gex application/vnd.geometry-explorer base64 +ggb application/vnd.geogebra.file base64 +ggt application/vnd.geogebra.tool base64 +ghf application/vnd.groove-help base64 +gif image/gif base64 +gim application/vnd.groove-identity-message base64 +gl video/gl base64 +gml application/gml+xml base64 +gmx application/vnd.gmx base64 +gnumeric application/x-gnumeric base64 +gpg application/octet-stream base64 +gph application/vnd.FloGraphIt base64 +gpx application/gpx+xml base64 +gqf application/vnd.grafeq base64 +gqs application/vnd.grafeq base64 +gram application/srgs base64 +gramps application/x-gramps-xml base64 +gre application/vnd.geometry-explorer base64 +grv application/vnd.groove-injector base64 +grxml application/srgs+xml base64 +gsf application/x-font-ghostscript base64 +gtar application/x-gtar base64 +gtm application/vnd.groove-tool-message base64 +gtw model/vnd.gtw base64 +gv text/vnd.graphviz quoted-printable +gxf application/gxf base64 +gxt application/vnd.geonext base64 +gz application/gzip base64 +h text/plain quoted-printable +h261 video/H261 base64 +h263 video/H263 base64 +h264 video/H264 base64 +hal application/vnd.hal+xml base64 +hbc application/vnd.hbci base64 +hbci application/vnd.hbci base64 +hdf application/x-hdf base64 +hep application/hep base64 +hh text/plain quoted-printable +hlp application/winhlp base64 +hpgl application/vnd.hp-HPGL base64 +hpid application/vnd.hp-hpid base64 +hpp text/plain quoted-printable +hps application/vnd.hp-hps base64 +hqx application/mac-binhex40 8bit +htc text/x-component 8bit +htke application/vnd.kenameaapp base64 +htm text/html 8bit +html text/html 8bit +htmlx text/html 8bit +htx text/html 8bit +hvd application/vnd.yamaha.hv-dic base64 +hvp application/vnd.yamaha.hv-voice base64 +hvs application/vnd.yamaha.hv-script base64 +i2g application/vnd.intergeo base64 +ibooks application/x-ibooks+zip base64 +ica application/x-ica base64 +icc application/vnd.iccprofile base64 +ice x-conference/x-cooltalk base64 +icm application/vnd.iccprofile base64 +ico image/vnd.microsoft.icon base64 +ics text/calendar quoted-printable +ief image/ief base64 +ifb text/calendar quoted-printable +ifm application/vnd.shana.informed.formdata base64 +iges model/iges base64 +igl application/vnd.igloader base64 +igm application/vnd.insors.igm base64 +igs model/iges base64 +igx application/vnd.micrografx.igx base64 +iif application/vnd.shana.informed.interchange base64 +imagemap application/imagemap 8bit +imap application/imagemap 8bit +imp application/vnd.accpac.simply.imp base64 +ims application/vnd.ms-ims base64 +in text/plain quoted-printable +ink application/inkml+xml base64 +inkml application/inkml+xml base64 +install application/x-install-instructions base64 +iota application/vnd.astraea-software.iota base64 +ipfix application/ipfix base64 +ipk application/vnd.shana.informed.package base64 +irm application/vnd.ibm.rights-management base64 +irp application/vnd.irepository.package+xml base64 +iso application/x-iso9660-image base64 +itp application/vnd.shana.informed.formtemplate base64 +ivf video/x-ivf base64 +ivp application/vnd.immervision-ivp base64 +ivu application/vnd.immervision-ivu base64 +jad text/vnd.sun.j2me.app-descriptor 8bit +jam application/vnd.jam base64 +jar application/java-archive base64 +java text/x-java-source quoted-printable +jisp application/vnd.jisp base64 +jlt application/vnd.hp-jlyt base64 +jnlp application/x-java-jnlp-file base64 +joda application/vnd.joost.joda-archive base64 +jp2 image/jp2 base64 +jpe image/jpeg base64 +jpeg image/jpeg base64 +jpf image/jpx base64 +jpg image/jpeg base64 +jpg2 image/jp2 base64 +jpgm image/jpm base64 +jpgv video/JPEG base64 +jpm image/jpm base64 +jpx image/jpx base64 +js application/javascript 8bit +json application/json 8bit +jsonml application/jsonml+json base64 +kar audio/midi base64 +karbon application/vnd.kde.karbon base64 +kcm application/vnd.nervana base64 +key application/x-iwork-keynote-sffkey base64 +kfo application/vnd.kde.kformula base64 +kia application/vnd.kidspiration base64 +kml application/vnd.google-earth.kml+xml 8bit +kmz application/vnd.google-earth.kmz 8bit +kne application/vnd.Kinar base64 +knp application/vnd.Kinar base64 +kom application/vnd.hbci base64 +kon application/vnd.kde.kontour base64 +kpr application/vnd.kde.kpresenter base64 +kpt application/vnd.kde.kpresenter base64 +kpxx application/vnd.ds-keypoint base64 +ksp application/vnd.kde.kspread base64 +ktr application/vnd.kahootz base64 +ktx image/ktx base64 +ktz application/vnd.kahootz base64 +kwd application/vnd.kde.kword base64 +kwt application/vnd.kde.kword base64 +l16 audio/L16 base64 +lasxml application/vnd.las.las+xml base64 +latex application/x-latex 8bit +lbd application/vnd.llamagraphics.life-balance.desktop base64 +lbe application/vnd.llamagraphics.life-balance.exchange+xml base64 +les application/vnd.hhe.lesson-player base64 +lha application/octet-stream base64 +link66 application/vnd.route66.link66+xml base64 +list text/plain quoted-printable +list3820 application/vnd.ibm.modcap base64 +listafp application/vnd.ibm.modcap base64 +lnk application/x-ms-shortcut base64 +log text/plain quoted-printable +lostxml application/lost+xml base64 +lrf application/octet-stream base64 +lrm application/vnd.ms-lrm base64 +ltf application/vnd.frogans.ltf base64 +ltx application/x-latex 8bit +lvp audio/vnd.lucent.voice base64 +lwp application/vnd.lotus-wordpro base64 +lzh application/octet-stream base64 +m13 application/x-msmediaview base64 +m14 application/x-msmediaview base64 +m1v video/mpeg base64 +m21 application/mp21 base64 +m2a audio/mpeg base64 +m2v video/mpeg base64 +m3a audio/mpeg base64 +m3u audio/x-mpegurl base64 +m3u8 application/vnd.apple.mpegurl base64 +m4a audio/mp4 base64 +m4u video/vnd.mpegurl 8bit +m4v video/vnd.objectvideo base64 +ma application/mathematica base64 +mads application/mads+xml base64 +mag application/vnd.ecowin.chart base64 +maker application/vnd.framemaker base64 +man application/x-troff-man 8bit +manifest text/cache-manifest quoted-printable +mar application/octet-stream base64 +markdown text/plain quoted-printable +mathml application/mathml+xml base64 +mb application/mathematica base64 +mbk application/vnd.Mobius.MBK base64 +mbox application/mbox base64 +mc1 application/vnd.medcalcdata base64 +mcd application/mathcad base64 +mcurl text/vnd.curl.mcurl quoted-printable +md text/plain quoted-printable +mda application/access base64 +mdb application/access base64 +mde application/access base64 +mdf application/access base64 +mdi image/vnd.ms-modi base64 +me application/x-troff-me base64 +mesh model/mesh base64 +meta4 application/metalink4+xml base64 +metalink application/metalink+xml base64 +mets application/mets+xml base64 +mfm application/vnd.mfmp base64 +mft application/rpki-manifest base64 +mgp application/vnd.osgeo.mapguide.package base64 +mgz application/vnd.proteus.magazine base64 +mid audio/midi base64 +midi audio/midi base64 +mie application/x-mie base64 +mif application/vnd.mif base64 +mime message/rfc822 8bit +mj2 video/MJ2 base64 +mjp2 video/MJ2 base64 +mjpeg video/x-motion-jpeg base64 +mjpg video/x-motion-jpeg base64 +mk3d video/x-matroska base64 +mka audio/x-matroska base64 +mks video/x-matroska base64 +mkv video/x-matroska base64 +mlp application/vnd.dolby.mlp base64 +mmd application/vnd.chipnuts.karaoke-mmd base64 +mmf application/vnd.smaf base64 +mmr image/vnd.fujixerox.edmics-mmr base64 +mng video/x-mng base64 +mny application/x-msmoney base64 +mobi application/x-mobipocket-ebook base64 +mods application/mods+xml base64 +mov video/quicktime base64 +movie video/x-sgi-movie base64 +mp2 audio/mpeg base64 +mp21 application/mp21 base64 +mp2a audio/mpeg base64 +mp3 audio/mpeg base64 +mp3g video/mpeg base64 +mp4 application/mp4 base64 +mp4a audio/mp4 base64 +mp4s application/mp4 base64 +mp4v video/mp4 base64 +mpc application/vnd.mophun.certificate base64 +mpe video/mpeg base64 +mpeg video/mpeg base64 +mpg video/mpeg base64 +mpg4 application/mp4 base64 +mpga audio/mpeg base64 +mpkg application/vnd.apple.installer+xml base64 +mpm application/vnd.blueice.multipass base64 +mpn application/vnd.mophun.application base64 +mpp application/vnd.ms-project base64 +mpt application/vnd.ms-project base64 +mpy application/vnd.ibm.MiniPay base64 +mqy application/vnd.Mobius.MQY base64 +mrc application/marc base64 +mrcx application/marcxml+xml base64 +ms application/x-troff-ms base64 +mscml application/mediaservercontrol+xml base64 +mseed application/vnd.fdsn.mseed base64 +mseq application/vnd.mseq base64 +msf application/vnd.epson.msf base64 +msg application/vnd.ms-outlook base64 +msh model/mesh base64 +msi application/x-msdownload base64 +msl application/vnd.Mobius.MSL base64 +msty application/vnd.muvee.style base64 +mts model/vnd.mts base64 +mus application/vnd.musician base64 +musicxml application/vnd.recordare.musicxml+xml base64 +mvb application/x-msmediaview base64 +mwf application/vnd.MFER base64 +mxf application/mxf base64 +mxl application/vnd.recordare.musicxml base64 +mxmf audio/vnd.nokia.mobile-xmf base64 +mxml application/xv+xml base64 +mxs application/vnd.triscape.mxs base64 +mxu video/vnd.mpegurl 8bit +n-gage application/vnd.nokia.n-gage.symbian.install base64 +n3 text/n3 quoted-printable +nb application/mathematica base64 +nbp application/vnd.wolfram.player base64 +nc application/netcdf base64 +ncx application/x-dtbncx+xml base64 +nfo text/x-nfo quoted-printable +ngdat application/vnd.nokia.n-gage.data base64 +nim video/vnd.nokia.interleaved-multimedia base64 +nitf application/vnd.nitf base64 +nlu application/vnd.neurolanguage.nlu base64 +nml application/vnd.enliven base64 +nnd application/vnd.noblenet-directory base64 +nns application/vnd.noblenet-sealer base64 +nnw application/vnd.noblenet-web base64 +npx image/vnd.net-fpx base64 +nsc application/x-conference base64 +nsf application/vnd.lotus-notes base64 +ntf application/vnd.nitf base64 +numbers application/x-iwork-numbers-sffnumbers base64 +nzb application/x-nzb base64 +oa2 application/vnd.fujitsu.oasys2 base64 +oa3 application/vnd.fujitsu.oasys3 base64 +oas application/vnd.fujitsu.oasys base64 +obd application/x-msbinder base64 +obj application/x-tgif base64 +oda application/oda base64 +odb application/vnd.oasis.opendocument.database base64 +odc application/vnd.oasis.opendocument.chart base64 +odf application/vnd.oasis.opendocument.formula base64 +odft application/vnd.oasis.opendocument.formula-template base64 +odg application/vnd.oasis.opendocument.graphics base64 +odi application/vnd.oasis.opendocument.image base64 +odm application/vnd.oasis.opendocument.text-master base64 +odp application/vnd.oasis.opendocument.presentation base64 +ods application/vnd.oasis.opendocument.spreadsheet base64 +odt application/vnd.oasis.opendocument.text base64 +oex application/x-opera-extension base64 +oga audio/ogg base64 +ogg audio/ogg base64 +ogv video/ogg base64 +ogx application/ogg base64 +omdoc application/omdoc+xml base64 +onepkg application/onenote base64 +onetmp application/onenote base64 +onetoc application/onenote base64 +onetoc2 application/onenote base64 +opf application/oebps-package+xml base64 +opml text/x-opml quoted-printable +oprc application/vnd.palm base64 +org application/vnd.lotus-organizer base64 +osf application/vnd.yamaha.openscoreformat base64 +osfpvg application/vnd.yamaha.openscoreformat.osfpvg+xml base64 +otc application/vnd.oasis.opendocument.chart-template base64 +otf application/font-sfnt base64 +otg application/vnd.oasis.opendocument.graphics-template base64 +oth application/vnd.oasis.opendocument.text-web base64 +oti application/vnd.oasis.opendocument.image-template base64 +otp application/vnd.oasis.opendocument.presentation-template base64 +ots application/vnd.oasis.opendocument.spreadsheet-template base64 +ott application/vnd.oasis.opendocument.text-template base64 +oxps application/oxps base64 +oxt application/vnd.openofficeorg.extension base64 +p text/x-pascal quoted-printable +p10 application/pkcs10 base64 +p12 application/x-pkcs12 base64 +p7b application/x-pkcs7-certificates base64 +p7c application/pkcs7-mime base64 +p7m application/pkcs7-mime base64 +p7r application/x-pkcs7-certreqresp base64 +p7s application/pkcs7-signature base64 +p8 application/pkcs8 base64 +pac application/x-ns-proxy-autoconfig base64 +pages application/x-iwork-pages-sffpages base64 +pas text/x-pascal quoted-printable +paw application/vnd.pawaafile base64 +pbd application/vnd.powerbuilder6 base64 +pbm image/x-portable-bitmap base64 +pcap application/vnd.tcpdump.pcap base64 +pcf application/x-font-pcf base64 +pcl application/vnd.hp-PCL base64 +pclxl application/vnd.hp-PCLXL base64 +pct image/x-pict base64 +pcurl application/vnd.curl.pcurl base64 +pcx image/x-pcx base64 +pdb application/vnd.palm base64 +pdf application/pdf base64 +pfa application/x-font-type1 base64 +pfb application/x-font-type1 base64 +pfm application/x-font-type1 base64 +pfr application/font-tdpfr base64 +pfx application/x-pkcs12 base64 +pgb image/vnd.globalgraphics.pgb base64 +pgm image/x-portable-graymap base64 +pgn application/x-chess-pgn base64 +pgp application/octet-stream base64 +php application/x-httpd-php 8bit +pht application/x-httpd-php 8bit +phtml application/x-httpd-php 8bit +pic image/x-pict base64 +pkd application/vnd.hbci base64 +pkg application/octet-stream base64 +pki application/pkixcmp base64 +pkipath application/pkix-pkipath base64 +pkpass application/vnd.apple.pkpass base64 +pl application/x-perl 8bit +plb application/vnd.3gpp.pic-bw-large base64 +plc application/vnd.Mobius.PLC base64 +plf application/vnd.pocketlearn base64 +plj audio/vnd.everad.plj base64 +pls application/pls+xml base64 +plt application/vnd.hp-HPGL base64 +pm application/x-pagemaker base64 +pm5 application/x-pagemaker base64 +pml application/vnd.ctc-posml base64 +png image/png base64 +pnm image/x-portable-anymap base64 +portpkg application/vnd.macports.portpkg base64 +pot application/powerpoint base64 +potm application/vnd.ms-powerpoint.template.macroEnabled.12 base64 +potx application/vnd.openxmlformats-officedocument.presentationml.template base64 +ppam application/vnd.ms-powerpoint.addin.macroEnabled.12 base64 +ppd application/vnd.cups-ppd base64 +ppm image/x-portable-pixmap base64 +pps application/powerpoint base64 +ppsm application/vnd.ms-powerpoint.slideshow.macroEnabled.12 base64 +ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow base64 +ppt application/powerpoint base64 +pptm application/vnd.ms-powerpoint.presentation.macroEnabled.12 base64 +pptx application/vnd.openxmlformats-officedocument.presentationml.presentation base64 +pqa application/vnd.palm base64 +prc application/vnd.palm base64 +pre application/vnd.lotus-freelance base64 +prf application/pics-rules base64 +ps application/postscript 8bit +ps1 application/x-msdos-program base64 +psb application/vnd.3gpp.pic-bw-small base64 +psd image/vnd.adobe.photoshop base64 +psf application/x-font-linux-psf base64 +pskcxml application/pskc+xml base64 +psp image/x-paintshoppro base64 +pspimage image/x-paintshoppro base64 +pt5 application/x-pagemaker base64 +pti application/vnd.pvi.ptid1 base64 +ptid application/vnd.pvi.ptid1 base64 +pub application/x-mspublisher base64 +pvb application/vnd.3gpp.pic-bw-var base64 +pwn application/vnd.3M.Post-it-Notes base64 +py application/x-python 8bit +pya audio/vnd.ms-playready.media.pya base64 +pyv video/vnd.ms-playready.media.pyv base64 +qam application/vnd.epson.quickanime base64 +qbo application/vnd.intu.qbo base64 +qcp audio/vnd.qcelp base64 +qfx application/vnd.intu.qfx base64 +qps application/vnd.publishare-delta-tree base64 +qt video/quicktime base64 +qtl application/quicktimeplayer base64 +qwd application/vnd.Quark.QuarkXPress 8bit +qwt application/vnd.Quark.QuarkXPress 8bit +qxb application/vnd.Quark.QuarkXPress 8bit +qxd application/vnd.Quark.QuarkXPress 8bit +qxl application/vnd.Quark.QuarkXPress 8bit +qxt application/vnd.Quark.QuarkXPress 8bit +ra audio/x-pn-realaudio base64 +ram audio/x-pn-realaudio base64 +rar application/x-rar-compressed base64 +ras image/x-cmu-raster base64 +rb application/x-ruby 8bit +rbw application/x-ruby 8bit +rcprofile application/vnd.ipunplugged.rcprofile base64 +rct application/prs.nprend base64 +rdf application/rdf+xml 8bit +rdz application/vnd.data-vision.rdz base64 +reg application/x-msdos-program base64 +rep application/vnd.businessobjects base64 +req application/vnd.nervana base64 +request application/vnd.nervana base64 +res application/x-dtbresource+xml base64 +rgb image/x-rgb base64 +rhtml application/x-html+ruby 8bit +rif application/reginfo+xml base64 +rip audio/vnd.rip base64 +ris application/x-research-info-systems base64 +rl application/resource-lists+xml base64 +rlc image/vnd.fujixerox.edmics-rlc base64 +rld application/resource-lists-diff+xml base64 +rm application/vnd.rn-realmedia base64 +rmi audio/midi base64 +rmp audio/x-pn-realaudio-plugin base64 +rms application/vnd.jcp.javame.midlet-rms base64 +rmvb application/vnd.rn-realmedia-vbr base64 +rnc application/relax-ng-compact-syntax base64 +rnd application/prs.nprend base64 +roa application/rpki-roa base64 +roff application/x-troff base64 +rp9 application/vnd.cloanto.rp9 base64 +rpm audio/x-pn-realaudio-plugin base64 +rpss application/vnd.nokia.radio-presets base64 +rpst application/vnd.nokia.radio-preset base64 +rq application/sparql-query base64 +rs application/rls-services+xml base64 +rsd application/rsd+xml base64 +rss application/rss+xml base64 +rst text/plain quoted-printable +rtf application/rtf base64 +rtx text/richtext 8bit +s text/x-asm quoted-printable +s11 video/vnd.sealed.mpeg1 base64 +s14 video/vnd.sealed.mpeg4 base64 +s1a application/vnd.sealedmedia.softseal.pdf base64 +s1e application/vnd.sealed.xls base64 +s1h application/vnd.sealedmedia.softseal.html base64 +s1m audio/vnd.sealedmedia.softseal.mpeg base64 +s1p application/vnd.sealed.ppt base64 +s1q video/vnd.sealedmedia.softseal.mov base64 +s1w application/vnd.sealed.doc base64 +s3m audio/s3m base64 +saf application/vnd.yamaha.smaf-audio base64 +sav application/x-spss base64 +sbml application/sbml+xml base64 +sbs application/x-spss base64 +sc application/vnd.ibm.secure-container base64 +scd application/x-msschedule base64 +scm application/vnd.lotus-screencam base64 +scq application/scvp-cv-request base64 +scs application/scvp-cv-response base64 +scurl text/vnd.curl.scurl quoted-printable +sda application/vnd.stardivision.draw base64 +sdc application/vnd.stardivision.calc base64 +sdd application/vnd.stardivision.impress base64 +sdf application/vnd.Kinar base64 +sdkd application/vnd.solent.sdkm+xml base64 +sdkm application/vnd.solent.sdkm+xml base64 +sdo application/vnd.sealed.doc base64 +sdoc application/vnd.sealed.doc base64 +sdp application/sdp base64 +sds application/vnd.stardivision.chart base64 +sdw application/vnd.stardivision.writer base64 +see application/vnd.seemail base64 +seed application/vnd.fdsn.seed base64 +sem application/vnd.sealed.eml base64 +sema application/vnd.sema base64 +semd application/vnd.semd base64 +semf application/vnd.semf base64 +seml application/vnd.sealed.eml base64 +ser application/java-serialized-object base64 +setpay application/set-payment-initiation base64 +setreg application/set-registration-initiation base64 +sfd-hdstx application/vnd.hydrostatix.sof-data base64 +sfs application/vnd.spotfire.sfs base64 +sfv text/x-sfv quoted-printable +sgi image/sgi base64 +sgl application/vnd.stardivision.writer-global base64 +sgm text/sgml quoted-printable +sgml application/sgml base64 +sh application/x-sh 8bit +shar application/x-shar 8bit +shf application/shf+xml base64 +shtml text/html 8bit +si text/vnd.wap.si quoted-printable +sic application/vnd.wap.sic base64 +sid image/x-mrsid-image base64 +sig application/pgp-signature base64 +sil audio/silk base64 +silo model/mesh base64 +sis application/vnd.symbian.install base64 +sisx application/vnd.symbian.install base64 +sit application/x-stuffit base64 +sitx application/x-stuffitx base64 +siv application/sieve base64 +sj application/javascript 8bit +skd application/vnd.koan base64 +skm application/vnd.koan base64 +skp application/vnd.koan base64 +skt application/vnd.koan base64 +sl text/vnd.wap.sl quoted-printable +slc application/vnd.wap.slc base64 +sldm application/vnd.ms-powerpoint.slide.macroEnabled.12 base64 +sldx application/vnd.openxmlformats-officedocument.presentationml.slide base64 +slt application/vnd.epson.salt base64 +sm application/vnd.stepmania.stepchart base64 +smf application/vnd.stardivision.math base64 +smh application/vnd.sealed.mht base64 +smht application/vnd.sealed.mht base64 +smi application/smil 8bit +smil application/smil 8bit +smo video/vnd.sealedmedia.softseal.mov base64 +smov video/vnd.sealedmedia.softseal.mov base64 +smp audio/vnd.sealedmedia.softseal.mpeg base64 +smp3 audio/vnd.sealedmedia.softseal.mpeg base64 +smpg video/vnd.sealed.mpeg4 base64 +sms application/vnd.3gpp.sms base64 +smv audio/SMV base64 +smzip application/vnd.stepmania.package base64 +snd audio/basic base64 +snf application/x-font-snf base64 +so application/octet-stream base64 +soc application/sgml-open-catalog base64 +spc application/x-pkcs7-certificates base64 +spd application/vnd.sealedmedia.softseal.pdf base64 +spdf application/vnd.sealedmedia.softseal.pdf base64 +spf application/vnd.yamaha.smaf-phrase base64 +spl application/futuresplash base64 +spo application/x-spss base64 +spot text/vnd.in3d.spot quoted-printable +spp application/scvp-vp-response base64 +sppt application/vnd.sealed.ppt base64 +spq application/scvp-vp-request base64 +sps application/x-spss base64 +spx audio/ogg base64 +sql application/x-sql base64 +src application/x-wais-source base64 +srt application/x-subrip base64 +sru application/sru+xml base64 +srx application/sparql-results+xml base64 +ssdl application/ssdl+xml base64 +sse application/vnd.kodak-descriptor base64 +ssf application/vnd.epson.ssf base64 +ssml application/ssml+xml base64 +ssw video/vnd.sealed.swf base64 +sswf video/vnd.sealed.swf base64 +st application/vnd.sailingtracker.track base64 +stc application/vnd.sun.xml.calc.template base64 +std application/vnd.sun.xml.draw.template base64 +stf application/vnd.wt.stf base64 +sti application/vnd.sun.xml.impress.template base64 +stk application/hyperstudio base64 +stl application/vnd.ms-pki.stl base64 +stm application/vnd.sealedmedia.softseal.html base64 +stml application/vnd.sealedmedia.softseal.html base64 +str application/vnd.pg.format base64 +stw application/vnd.sun.xml.writer.template base64 +sub image/vnd.dvb.subtitle base64 +sus application/vnd.sus-calendar base64 +susp application/vnd.sus-calendar base64 +sv4cpio application/x-sv4cpio base64 +sv4crc application/x-sv4crc base64 +svc application/vnd.dvb.service base64 +svd application/vnd.svd base64 +svg image/svg+xml 8bit +svgz image/svg+xml 8bit +swa application/x-director base64 +swf application/x-shockwave-flash base64 +swi application/vnd.aristanetworks.swi base64 +sxc application/vnd.sun.xml.calc base64 +sxd application/vnd.sun.xml.draw base64 +sxg application/vnd.sun.xml.writer.global base64 +sxi application/vnd.sun.xml.impress base64 +sxl application/vnd.sealed.xls base64 +sxls application/vnd.sealed.xls base64 +sxm application/vnd.sun.xml.math base64 +sxw application/vnd.sun.xml.writer base64 +t application/x-troff base64 +t3 application/x-t3vm-image base64 +taglet application/vnd.mynfc base64 +tao application/vnd.tao.intent-module-archive base64 +tar application/x-tar base64 +tbk application/toolbook base64 +tbz application/x-gtar base64 +tbz2 application/x-gtar base64 +tcap application/vnd.3gpp2.tcap base64 +tcl application/x-tcl 8bit +teacher application/vnd.smart.teacher base64 +tei application/tei+xml base64 +teicorpus application/tei+xml base64 +tex application/x-tex 8bit +texi application/x-texinfo 8bit +texinfo application/x-texinfo 8bit +text text/plain quoted-printable +textile text/plain quoted-printable +tfi application/thraud+xml base64 +tfm application/x-tex-tfm base64 +tga image/targa base64 +tgz application/x-gtar base64 +thmx application/vnd.ms-officetheme base64 +tif image/tiff base64 +tiff image/tiff base64 +tmo application/vnd.tmobile-livetv base64 +torrent application/x-bittorrent base64 +tpl application/vnd.groove-tool-template base64 +tpt application/vnd.trid.tpt base64 +tr application/x-troff base64 +tra application/vnd.trueapp base64 +trm application/x-msterminal base64 +troff text/troff 8bit +ts video/MP2T base64 +tsd application/timestamped-data base64 +tsv text/tab-separated-values quoted-printable +ttc application/x-font-ttf base64 +ttf application/font-sfnt base64 +ttl text/turtle quoted-printable +twd application/vnd.SimTech-MindMapper base64 +twds application/vnd.SimTech-MindMapper base64 +txd application/vnd.genomatix.tuxedo base64 +txf application/vnd.Mobius.TXF base64 +txt text/plain quoted-printable +u32 application/x-authorware-bin base64 +udeb application/x-debian-package base64 +ufd application/vnd.ufdl base64 +ufdl application/vnd.ufdl base64 +ulx application/x-glulx base64 +umj application/vnd.umajin base64 +unityweb application/vnd.unity base64 +uoml application/vnd.uoml+xml base64 +upa application/vnd.hbci base64 +uri text/uri-list quoted-printable +uris text/uri-list quoted-printable +urls text/uri-list quoted-printable +ustar application/x-ustar base64 +utz application/vnd.uiq.theme base64 +uu text/x-uuencode quoted-printable +uva audio/vnd.dece.audio base64 +uvd application/vnd.dece.data base64 +uvf application/vnd.dece.data base64 +uvg image/vnd.dece.graphic base64 +uvh video/vnd.dece.hd base64 +uvi image/vnd.dece.graphic base64 +uvm video/vnd.dece.mobile base64 +uvp video/vnd.dece.pd base64 +uvs video/vnd.dece.sd base64 +uvt application/vnd.dece.ttml+xml base64 +uvu video/vnd.uvvu.mp4 base64 +uvv video/vnd.dece.video base64 +uvva audio/vnd.dece.audio base64 +uvvd application/vnd.dece.data base64 +uvvf application/vnd.dece.data base64 +uvvg image/vnd.dece.graphic base64 +uvvh video/vnd.dece.hd base64 +uvvi image/vnd.dece.graphic base64 +uvvm video/vnd.dece.mobile base64 +uvvp video/vnd.dece.pd base64 +uvvs video/vnd.dece.sd base64 +uvvt application/vnd.dece.ttml+xml base64 +uvvu video/vnd.uvvu.mp4 base64 +uvvv video/vnd.dece.video base64 +uvvx application/vnd.dece.unspecified base64 +uvvz application/vnd.dece.zip base64 +uvx application/vnd.dece.unspecified base64 +uvz application/vnd.dece.zip base64 +vbk audio/vnd.nortel.vbk base64 +vbs application/x-msdos-program base64 +vcard text/vcard quoted-printable +vcd application/x-cdlink base64 +vcf text/x-vcard 8bit +vcg application/vnd.groove-vcard base64 +vcs text/x-vcalendar 8bit +vcx application/vnd.vcx base64 +vis application/vnd.visionary base64 +viv video/vnd.vivo base64 +vivo video/vnd.vivo base64 +vob video/x-ms-vob base64 +vor application/vnd.stardivision.writer base64 +vox application/x-authorware-bin base64 +vrml model/vrml base64 +vsc application/vnd.vidsoft.vidconference 8bit +vsd application/vnd.visio base64 +vsf application/vnd.vsf base64 +vss application/vnd.visio base64 +vst application/vnd.visio base64 +vsw application/vnd.visio base64 +vtu model/vnd.vtu base64 +vxml application/voicexml+xml base64 +w3d application/x-director base64 +wad application/x-doom base64 +wav audio/x-wav base64 +wax audio/x-ms-wax base64 +wbmp image/vnd.wap.wbmp base64 +wbs application/vnd.criticaltools.wbs+xml base64 +wbxml application/vnd.wap.wbxml base64 +wcm application/vnd.ms-works base64 +wdb application/vnd.ms-works base64 +wdp image/vnd.ms-photo base64 +weba audio/webm base64 +webapp application/x-web-app-manifest+json base64 +webm audio/webm base64 +webp image/webp base64 +wg application/vnd.pmi.widget base64 +wgt application/widget base64 +wif application/watcherinfo+xml base64 +wk application/x-123 base64 +wks application/lotus-123 base64 +wkz application/x-Wingz base64 +wm video/x-ms-wm base64 +wma audio/x-ms-wma base64 +wmd application/x-ms-wmd base64 +wmf application/x-msmetafile base64 +wml text/vnd.wap.wml quoted-printable +wmlc application/vnd.wap.wmlc base64 +wmls text/vnd.wap.wmlscript quoted-printable +wmlsc application/vnd.wap.wmlscriptc base64 +wmv audio/x-ms-wmv base64 +wmx video/x-ms-wmx base64 +wmz application/x-ms-wmz base64 +woff application/font-woff base64 +woff2 application/font-woff base64 +wp application/wordperfect base64 +wp5 application/wordperfect5.1 base64 +wp6 application/wordperfect6.1 base64 +wpd application/vnd.wordperfect base64 +wpl application/vnd.ms-wpl base64 +wps application/vnd.ms-works base64 +wqd application/vnd.wqd base64 +wrd application/msword base64 +wri application/x-mswrite base64 +wrl model/vrml base64 +wsdl application/wsdl+xml base64 +wspolicy application/wspolicy+xml base64 +wtb application/vnd.webturbo base64 +wv application/vnd.wv.csp+wbxml base64 +wvx video/x-ms-wvx base64 +wz application/x-Wingz base64 +x32 application/x-authorware-bin base64 +x3d model/x3d+xml base64 +x3db model/x3d+binary base64 +x3dbz model/x3d+binary base64 +x3dv model/x3d+vrml base64 +x3dvz model/x3d+vrml base64 +x3dz model/x3d+xml base64 +x_b model/vnd.parasolid.transmit.binary base64 +x_t model/vnd.parasolid.transmit.text quoted-printable +xaml application/xaml+xml base64 +xap application/x-silverlight-app base64 +xar application/vnd.xara base64 +xbap application/x-ms-xbap base64 +xbd application/vnd.fujixerox.docuworks.binder base64 +xbm image/x-xbitmap 7bit +xcf image/x-xcf base64 +xcfbz2 image/x-compressed-xcf base64 +xcfgz image/x-compressed-xcf base64 +xdf application/xcap-diff+xml base64 +xdm application/vnd.syncml.dm+xml base64 +xdp application/vnd.adobe.xdp+xml base64 +xdssc application/dssc+xml base64 +xdw application/vnd.fujixerox.docuworks base64 +xenc application/xenc+xml base64 +xer application/patch-ops-error+xml base64 +xfdf application/vnd.adobe.xfdf base64 +xfdl application/vnd.xfdl base64 +xht application/xhtml+xml 8bit +xhtml application/xhtml+xml 8bit +xhvml application/xv+xml base64 +xif image/vnd.xiff base64 +xla application/vnd.ms-excel base64 +xlam application/vnd.ms-excel.addin.macroEnabled.12 base64 +xlc application/vnd.ms-excel base64 +xlf application/x-xliff+xml base64 +xlm application/vnd.ms-excel base64 +xls application/excel base64 +xlsb application/vnd.ms-excel.sheet.binary.macroEnabled.12 base64 +xlsm application/vnd.ms-excel.sheet.macroEnabled.12 base64 +xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet base64 +xlt application/excel base64 +xltm application/vnd.ms-excel.template.macroEnabled.12 base64 +xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template base64 +xlw application/vnd.ms-excel base64 +xm audio/xm base64 +xml application/xml 8bit +xmt_bin model/vnd.parasolid.transmit.binary base64 +xmt_txt model/vnd.parasolid.transmit.text quoted-printable +xo application/vnd.olpc-sugar base64 +xop application/xop+xml base64 +xpi application/x-xpinstall base64 +xpl application/xproc+xml base64 +xpm image/x-xpixmap 8bit +xpr application/vnd.is-xpr base64 +xps application/vnd.ms-xpsdocument 8bit +xpw application/vnd.intercon.formnet base64 +xpx application/vnd.intercon.formnet base64 +xsl application/xml 8bit +xslt application/xslt+xml base64 +xsm application/vnd.syncml+xml base64 +xspf application/xspf+xml base64 +xul application/vnd.mozilla.xul+xml base64 +xvm application/xv+xml base64 +xvml application/xv+xml base64 +xwd image/x-xwindowdump base64 +xyz chemical/x-xyz base64 +xz application/x-xz base64 +yaml text/x-yaml 8bit +yang application/yang base64 +yin application/yin+xml base64 +yml text/x-yaml 8bit +z application/x-compress base64 +z1 application/x-zmachine base64 +z2 application/x-zmachine base64 +z3 application/x-zmachine base64 +z4 application/x-zmachine base64 +z5 application/x-zmachine base64 +z6 application/x-zmachine base64 +z7 application/x-zmachine base64 +z8 application/x-zmachine base64 +zaz application/vnd.zzazz.deck+xml base64 +zip application/zip base64 +zir application/vnd.zul base64 +zirz application/vnd.zul base64 +zmm application/vnd.HandHeld-Entertainment+xml base64 diff --git a/lib/mini_mime.rb b/lib/mini_mime.rb new file mode 100644 index 0000000..94f1e4a --- /dev/null +++ b/lib/mini_mime.rb @@ -0,0 +1,90 @@ +require "mini_mime/version" +require "thread" + +module MiniMime + BINARY_ENCODINGS = %w(base64 8bit) + + # return true if this filename is known to have binary encoding + # + # puts MiniMime.binary?("file.gif") => true + # puts MiniMime.binary?("file.txt") => false + def self.binary?(filename) + info = Db.lookup(filename) + !!(info && BINARY_ENCODINGS.include?(info.encoding)) + end + + # return first matching content type for a file + # + # puts MiniMime.content_type("test.xml") => "application/xml" + # puts MiniMime.content_type("test.gif") => "image/gif" + def self.content_type(filename) + info = Db.lookup(filename) + info && info.content_type + end + + class Info + attr_accessor :extension, :content_type, :encoding + def initialize(buffer) + @extension,@content_type,@encoding = buffer.split(/\s+/).map!(&:freeze) + end + end + + class Db + LOCK = Mutex.new + def self.lookup(filename) + extension = File.extname(filename) + if extension + extension.sub!(".", "") + if extension.length > 0 + LOCK.synchronize do + @db = new + @db.lookup(extension) + end + else + nil + end + end + end + + def initialize + @db_path ||= File.expand_path("../db/mime.db", __FILE__) + @file ||= File.open(@db_path) + @cache = {} + @row_length = @file.readline.length + @file_length = @file.size + @rows = @file_length / @row_length + end + + def lookup(extension) + @cache.fetch(extension) do + @cache[extension] = lookup_uncached(extension) + end + end + + #lifted from marcandre/backports + def lookup_uncached(extension) + from = 0 + to = @rows - 1 + result = nil + + while from <= to do + midpoint = from + (to-from).div(2) + current = resolve(midpoint) + if current.extension > extension + to = midpoint - 1 + elsif current.extension < extension + from = midpoint + 1 + else + result = current + break + end + end + result + end + + def resolve(row) + @file.seek(row*@row_length) + Info.new(@file.readline) + end + end +end diff --git a/lib/mini_mime/version.rb b/lib/mini_mime/version.rb new file mode 100644 index 0000000..71e6e39 --- /dev/null +++ b/lib/mini_mime/version.rb @@ -0,0 +1,3 @@ +module MiniMime + VERSION = "0.1.0" +end diff --git a/mini_mime.gemspec b/mini_mime.gemspec new file mode 100644 index 0000000..a23e3c6 --- /dev/null +++ b/mini_mime.gemspec @@ -0,0 +1,37 @@ +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'mini_mime/version' + +Gem::Specification.new do |spec| + spec.name = "mini_mime" + spec.version = MiniMime::VERSION + spec.authors = ["Sam Saffron"] + spec.email = ["sam.saffron@gmail.com"] + + spec.summary = %q{A lightweight mime type lookup toy} + spec.description = %q{A lightweight mime type lookup toy} + spec.homepage = "" + spec.license = "MIT" + + # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' + # to allow pushing to a single host or delete this section to allow pushing to any host. + if spec.respond_to?(:metadata) + spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" + else + raise "RubyGems 2.0 or newer is required to protect against " \ + "public gem pushes." + end + + spec.files = `git ls-files -z`.split("\x0").reject do |f| + f.match(%r{^(test|spec|features)/}) + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + spec.add_development_dependency "bundler", "~> 1.13" + spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "minitest", "~> 5.0" + spec.add_development_dependency "mime-types", "~> 3" +end diff --git a/test/mini_mime_test.rb b/test/mini_mime_test.rb new file mode 100644 index 0000000..d5b771a --- /dev/null +++ b/test/mini_mime_test.rb @@ -0,0 +1,23 @@ +require 'test_helper' + +class MiniMimeTest < Minitest::Test + def test_that_it_has_a_version_number + refute_nil ::MiniMime::VERSION + end + + + def test_content_type + # keep lotus alive cause these files are EVERYWHERE + assert_equal "application/vnd.lotus-1-2-3", MiniMime.content_type("a.123") + assert_equal "application/x-compress", MiniMime.content_type("a.Z") + assert_equal "application/vnd.groove-tool-message", MiniMime.content_type("a.gtm") + assert_equal "application/vnd.HandHeld-Entertainment+xml", MiniMime.content_type("a.zmm") + assert_nil MiniMime.content_type("a.frog") + end + + def test_binary + assert MiniMime.binary?("a.Z") + refute MiniMime.binary?("a.txt") + refute MiniMime.binary?("a.frog") + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..405203b --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,4 @@ +$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) +require 'mini_mime' + +require 'minitest/autorun'