mime_typer 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +8 -0
  2. data/Rakefile +11 -0
  3. data/lib/mime.types +752 -0
  4. data/lib/mime_typer.rb +25 -0
  5. metadata +75 -0
data/README.rdoc ADDED
@@ -0,0 +1,8 @@
1
+ = mime_typer
2
+
3
+ Simple and straightforward MIME types. Reads your /etc/mime.types file, its own built-in copy, or the file you specify, to get the MIME type for your file.
4
+
5
+ == Usage
6
+
7
+ * MimeTyper.type_for("somefile.html")
8
+
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'rake'
2
+
3
+ require 'spec/rake/spectask'
4
+ Spec::Rake::SpecTask.new(:spec) do |spec|
5
+ spec.ruby_opts << '-rubygems'
6
+ spec.libs << 'lib' << 'spec'
7
+ spec.spec_files = FileList['spec/**/*_spec.rb']
8
+ spec.spec_opts = ['--options', 'spec/spec.opts']
9
+ end
10
+
11
+ task :default => [:spec]
data/lib/mime.types ADDED
@@ -0,0 +1,752 @@
1
+ ###############################################################################
2
+ #
3
+ # MIME-TYPES and the extensions that represent them
4
+ #
5
+ # This file is part of the "mime-support" package. Please send email (not a
6
+ # bug report) to mime-support@packages.debian.org if you would like new types
7
+ # and/or extensions to be added.
8
+ #
9
+ # The reason that all types are managed by the mime-support package instead
10
+ # allowing individual packages to install types in much the same way as they
11
+ # add entries in to the mailcap file is so these types can be referenced by
12
+ # other programs (such as a web server) even if the specific support package
13
+ # for that type is not installed.
14
+ #
15
+ # Users can add their own types if they wish by creating a ".mime.types"
16
+ # file in their home directory. Definitions included there will take
17
+ # precedence over those listed here.
18
+ #
19
+ # Note: Compression schemes like "gzip", "bzip", and "compress" are not
20
+ # actually "mime-types". They are "encodings" and hence must _not_ have
21
+ # entries in this file to map their extensions. The "mime-type" of an
22
+ # encoded file refers to the type of data that has been encoded, not the
23
+ # type of encoding.
24
+ #
25
+ ###############################################################################
26
+
27
+
28
+ application/activemessage
29
+ application/andrew-inset ez
30
+ application/applefile
31
+ application/atom atom
32
+ application/atomcat+xml atomcat
33
+ application/atomserv+xml atomsrv
34
+ application/atomicmail
35
+ application/batch-SMTP
36
+ application/beep+xml
37
+ application/cals-1840
38
+ application/cap cap pcap
39
+ application/commonground
40
+ application/cu-seeme cu
41
+ application/cybercash
42
+ application/dca-rft
43
+ application/dec-dx
44
+ application/docbook+xml
45
+ application/dsptype tsp
46
+ application/dvcs
47
+ application/edi-consent
48
+ application/edi-x12
49
+ application/edifact
50
+ application/eshop
51
+ application/font-tdpfr
52
+ application/futuresplash spl
53
+ application/ghostview
54
+ application/hta hta
55
+ application/http
56
+ application/hyperstudio
57
+ application/iges
58
+ application/index
59
+ application/index.cmd
60
+ application/index.obj
61
+ application/index.response
62
+ application/index.vnd
63
+ application/iotp
64
+ application/ipp
65
+ application/isup
66
+ application/java-archive jar
67
+ application/java-serialized-object ser
68
+ application/java-vm class
69
+ application/mac-binhex40 hqx
70
+ application/mac-compactpro cpt
71
+ application/macwriteii
72
+ application/marc
73
+ application/mathematica nb
74
+ application/mathematica-old
75
+ application/ms-tnef
76
+ application/msaccess mdb
77
+ application/msword doc dot
78
+ application/news-message-id
79
+ application/news-transmission
80
+ application/ocsp-request
81
+ application/ocsp-response
82
+ application/octet-stream bin
83
+ application/oda oda
84
+ application/ogg ogg ogx
85
+ application/parityfec
86
+ application/pdf pdf
87
+ application/pgp-encrypted
88
+ application/pgp-keys key
89
+ application/pgp-signature pgp
90
+ application/pics-rules prf
91
+ application/pkcs10
92
+ application/pkcs7-mime
93
+ application/pkcs7-signature
94
+ application/pkix-cert
95
+ application/pkix-crl
96
+ application/pkixcmp
97
+ application/postscript ps ai eps
98
+ application/prs.alvestrand.titrax-sheet
99
+ application/prs.cww
100
+ application/prs.nprend
101
+ application/qsig
102
+ application/rar rar
103
+ application/rdf+xml rdf
104
+ application/remote-printing
105
+ application/riscos
106
+ application/rss+xml rss
107
+ application/rtf rtf
108
+ application/sdp
109
+ application/set-payment
110
+ application/set-payment-initiation
111
+ application/set-registration
112
+ application/set-registration-initiation
113
+ application/sgml
114
+ application/sgml-open-catalog
115
+ application/sieve
116
+ application/slate
117
+ application/smil smi smil
118
+ application/timestamp-query
119
+ application/timestamp-reply
120
+ application/vemmi
121
+ application/whoispp-query
122
+ application/whoispp-response
123
+ application/wita
124
+ application/wordperfect wpd
125
+ application/wordperfect5.1 wp5
126
+ application/x400-bp
127
+ application/xhtml+xml xhtml xht
128
+ application/xml xml xsl
129
+ application/xml-dtd
130
+ application/xml-external-parsed-entity
131
+ application/zip zip
132
+ application/vnd.3M.Post-it-Notes
133
+ application/vnd.accpac.simply.aso
134
+ application/vnd.accpac.simply.imp
135
+ application/vnd.acucobol
136
+ application/vnd.aether.imp
137
+ application/vnd.anser-web-certificate-issue-initiation
138
+ application/vnd.anser-web-funds-transfer-initiation
139
+ application/vnd.audiograph
140
+ application/vnd.bmi
141
+ application/vnd.businessobjects
142
+ application/vnd.canon-cpdl
143
+ application/vnd.canon-lips
144
+ application/vnd.cinderella cdy
145
+ application/vnd.claymore
146
+ application/vnd.commerce-battelle
147
+ application/vnd.commonspace
148
+ application/vnd.comsocaller
149
+ application/vnd.contact.cmsg
150
+ application/vnd.cosmocaller
151
+ application/vnd.ctc-posml
152
+ application/vnd.cups-postscript
153
+ application/vnd.cups-raster
154
+ application/vnd.cups-raw
155
+ application/vnd.cybank
156
+ application/vnd.dna
157
+ application/vnd.dpgraph
158
+ application/vnd.dxr
159
+ application/vnd.ecdis-update
160
+ application/vnd.ecowin.chart
161
+ application/vnd.ecowin.filerequest
162
+ application/vnd.ecowin.fileupdate
163
+ application/vnd.ecowin.series
164
+ application/vnd.ecowin.seriesrequest
165
+ application/vnd.ecowin.seriesupdate
166
+ application/vnd.enliven
167
+ application/vnd.epson.esf
168
+ application/vnd.epson.msf
169
+ application/vnd.epson.quickanime
170
+ application/vnd.epson.salt
171
+ application/vnd.epson.ssf
172
+ application/vnd.ericsson.quickcall
173
+ application/vnd.eudora.data
174
+ application/vnd.fdf
175
+ application/vnd.ffsns
176
+ application/vnd.flographit
177
+ application/vnd.framemaker
178
+ application/vnd.fsc.weblaunch
179
+ application/vnd.fujitsu.oasys
180
+ application/vnd.fujitsu.oasys2
181
+ application/vnd.fujitsu.oasys3
182
+ application/vnd.fujitsu.oasysgp
183
+ application/vnd.fujitsu.oasysprs
184
+ application/vnd.fujixerox.ddd
185
+ application/vnd.fujixerox.docuworks
186
+ application/vnd.fujixerox.docuworks.binder
187
+ application/vnd.fut-misnet
188
+ application/vnd.google-earth.kml+xml kml
189
+ application/vnd.google-earth.kmz kmz
190
+ application/vnd.grafeq
191
+ application/vnd.groove-account
192
+ application/vnd.groove-identity-message
193
+ application/vnd.groove-injector
194
+ application/vnd.groove-tool-message
195
+ application/vnd.groove-tool-template
196
+ application/vnd.groove-vcard
197
+ application/vnd.hhe.lesson-player
198
+ application/vnd.hp-HPGL
199
+ application/vnd.hp-PCL
200
+ application/vnd.hp-PCLXL
201
+ application/vnd.hp-hpid
202
+ application/vnd.hp-hps
203
+ application/vnd.httphone
204
+ application/vnd.hzn-3d-crossword
205
+ application/vnd.ibm.MiniPay
206
+ application/vnd.ibm.afplinedata
207
+ application/vnd.ibm.modcap
208
+ application/vnd.informix-visionary
209
+ application/vnd.intercon.formnet
210
+ application/vnd.intertrust.digibox
211
+ application/vnd.intertrust.nncp
212
+ application/vnd.intu.qbo
213
+ application/vnd.intu.qfx
214
+ application/vnd.irepository.package+xml
215
+ application/vnd.is-xpr
216
+ application/vnd.japannet-directory-service
217
+ application/vnd.japannet-jpnstore-wakeup
218
+ application/vnd.japannet-payment-wakeup
219
+ application/vnd.japannet-registration
220
+ application/vnd.japannet-registration-wakeup
221
+ application/vnd.japannet-setstore-wakeup
222
+ application/vnd.japannet-verification
223
+ application/vnd.japannet-verification-wakeup
224
+ application/vnd.koan
225
+ application/vnd.lotus-1-2-3
226
+ application/vnd.lotus-approach
227
+ application/vnd.lotus-freelance
228
+ application/vnd.lotus-notes
229
+ application/vnd.lotus-organizer
230
+ application/vnd.lotus-screencam
231
+ application/vnd.lotus-wordpro
232
+ application/vnd.mcd
233
+ application/vnd.mediastation.cdkey
234
+ application/vnd.meridian-slingshot
235
+ application/vnd.mif
236
+ application/vnd.minisoft-hp3000-save
237
+ application/vnd.mitsubishi.misty-guard.trustweb
238
+ application/vnd.mobius.daf
239
+ application/vnd.mobius.dis
240
+ application/vnd.mobius.msl
241
+ application/vnd.mobius.plc
242
+ application/vnd.mobius.txf
243
+ application/vnd.motorola.flexsuite
244
+ application/vnd.motorola.flexsuite.adsi
245
+ application/vnd.motorola.flexsuite.fis
246
+ application/vnd.motorola.flexsuite.gotap
247
+ application/vnd.motorola.flexsuite.kmr
248
+ application/vnd.motorola.flexsuite.ttc
249
+ application/vnd.motorola.flexsuite.wem
250
+ application/vnd.mozilla.xul+xml xul
251
+ application/vnd.ms-artgalry
252
+ application/vnd.ms-asf
253
+ application/vnd.ms-excel xls xlb xlt
254
+ application/vnd.ms-lrm
255
+ application/vnd.ms-pki.seccat cat
256
+ application/vnd.ms-pki.stl stl
257
+ application/vnd.ms-powerpoint ppt pps
258
+ application/vnd.ms-project
259
+ application/vnd.ms-tnef
260
+ application/vnd.ms-works
261
+ application/vnd.mseq
262
+ application/vnd.msign
263
+ application/vnd.music-niff
264
+ application/vnd.musician
265
+ application/vnd.netfpx
266
+ application/vnd.noblenet-directory
267
+ application/vnd.noblenet-sealer
268
+ application/vnd.noblenet-web
269
+ application/vnd.novadigm.EDM
270
+ application/vnd.novadigm.EDX
271
+ application/vnd.novadigm.EXT
272
+ application/vnd.oasis.opendocument.chart odc
273
+ application/vnd.oasis.opendocument.database odb
274
+ application/vnd.oasis.opendocument.formula odf
275
+ application/vnd.oasis.opendocument.graphics odg
276
+ application/vnd.oasis.opendocument.graphics-template otg
277
+ application/vnd.oasis.opendocument.image odi
278
+ application/vnd.oasis.opendocument.presentation odp
279
+ application/vnd.oasis.opendocument.presentation-template otp
280
+ application/vnd.oasis.opendocument.spreadsheet ods
281
+ application/vnd.oasis.opendocument.spreadsheet-template ots
282
+ application/vnd.oasis.opendocument.text odt
283
+ application/vnd.oasis.opendocument.text-master odm
284
+ application/vnd.oasis.opendocument.text-template ott
285
+ application/vnd.oasis.opendocument.text-web oth
286
+ application/vnd.osa.netdeploy
287
+ application/vnd.palm
288
+ application/vnd.pg.format
289
+ application/vnd.pg.osasli
290
+ application/vnd.powerbuilder6
291
+ application/vnd.powerbuilder6-s
292
+ application/vnd.powerbuilder7
293
+ application/vnd.powerbuilder7-s
294
+ application/vnd.powerbuilder75
295
+ application/vnd.powerbuilder75-s
296
+ application/vnd.previewsystems.box
297
+ application/vnd.publishare-delta-tree
298
+ application/vnd.pvi.ptid1
299
+ application/vnd.pwg-xhtml-print+xml
300
+ application/vnd.rapid
301
+ application/vnd.rim.cod cod
302
+ application/vnd.s3sms
303
+ application/vnd.seemail
304
+ application/vnd.shana.informed.formdata
305
+ application/vnd.shana.informed.formtemplate
306
+ application/vnd.shana.informed.interchange
307
+ application/vnd.shana.informed.package
308
+ application/vnd.smaf mmf
309
+ application/vnd.sss-cod
310
+ application/vnd.sss-dtf
311
+ application/vnd.sss-ntf
312
+ application/vnd.stardivision.calc sdc
313
+ application/vnd.stardivision.chart sds
314
+ application/vnd.stardivision.draw sda
315
+ application/vnd.stardivision.impress sdd
316
+ application/vnd.stardivision.math sdf
317
+ application/vnd.stardivision.writer sdw
318
+ application/vnd.stardivision.writer-global sgl
319
+ application/vnd.street-stream
320
+ application/vnd.sun.xml.calc sxc
321
+ application/vnd.sun.xml.calc.template stc
322
+ application/vnd.sun.xml.draw sxd
323
+ application/vnd.sun.xml.draw.template std
324
+ application/vnd.sun.xml.impress sxi
325
+ application/vnd.sun.xml.impress.template sti
326
+ application/vnd.sun.xml.math sxm
327
+ application/vnd.sun.xml.writer sxw
328
+ application/vnd.sun.xml.writer.global sxg
329
+ application/vnd.sun.xml.writer.template stw
330
+ application/vnd.svd
331
+ application/vnd.swiftview-ics
332
+ application/vnd.symbian.install sis
333
+ application/vnd.triscape.mxs
334
+ application/vnd.trueapp
335
+ application/vnd.truedoc
336
+ application/vnd.tve-trigger
337
+ application/vnd.ufdl
338
+ application/vnd.uplanet.alert
339
+ application/vnd.uplanet.alert-wbxml
340
+ application/vnd.uplanet.bearer-choice
341
+ application/vnd.uplanet.bearer-choice-wbxml
342
+ application/vnd.uplanet.cacheop
343
+ application/vnd.uplanet.cacheop-wbxml
344
+ application/vnd.uplanet.channel
345
+ application/vnd.uplanet.channel-wbxml
346
+ application/vnd.uplanet.list
347
+ application/vnd.uplanet.list-wbxml
348
+ application/vnd.uplanet.listcmd
349
+ application/vnd.uplanet.listcmd-wbxml
350
+ application/vnd.uplanet.signal
351
+ application/vnd.vcx
352
+ application/vnd.vectorworks
353
+ application/vnd.vidsoft.vidconference
354
+ application/vnd.visio vsd
355
+ application/vnd.vividence.scriptfile
356
+ application/vnd.wap.sic
357
+ application/vnd.wap.slc
358
+ application/vnd.wap.wbxml wbxml
359
+ application/vnd.wap.wmlc wmlc
360
+ application/vnd.wap.wmlscriptc wmlsc
361
+ application/vnd.webturbo
362
+ application/vnd.wrq-hp3000-labelled
363
+ application/vnd.wt.stf
364
+ application/vnd.xara
365
+ application/vnd.xfdl
366
+ application/vnd.yellowriver-custom-menu
367
+ application/x-123 wk
368
+ application/x-7z-compressed 7z
369
+ application/x-abiword abw
370
+ application/x-apple-diskimage dmg
371
+ application/x-bcpio bcpio
372
+ application/x-bittorrent torrent
373
+ application/x-cab cab
374
+ application/x-cbr cbr
375
+ application/x-cbz cbz
376
+ application/x-cdf cdf
377
+ application/x-cdlink vcd
378
+ application/x-chess-pgn pgn
379
+ application/x-core
380
+ application/x-cpio cpio
381
+ application/x-csh csh
382
+ application/x-debian-package deb udeb
383
+ application/x-director dcr dir dxr
384
+ application/x-dms dms
385
+ application/x-doom wad
386
+ application/x-dvi dvi
387
+ application/x-httpd-eruby rhtml
388
+ application/x-executable
389
+ application/x-flac flac
390
+ application/x-font pfa pfb gsf pcf pcf.Z
391
+ application/x-freemind mm
392
+ application/x-futuresplash spl
393
+ application/x-gnumeric gnumeric
394
+ application/x-go-sgf sgf
395
+ application/x-graphing-calculator gcf
396
+ application/x-gtar gtar tgz taz
397
+ application/x-hdf hdf
398
+ application/x-httpd-php phtml pht php
399
+ application/x-httpd-php-source phps
400
+ application/x-httpd-php3 php3
401
+ application/x-httpd-php3-preprocessed php3p
402
+ application/x-httpd-php4 php4
403
+ application/x-ica ica
404
+ application/x-internet-signup ins isp
405
+ application/x-iphone iii
406
+ application/x-iso9660-image iso
407
+ application/x-java-applet
408
+ application/x-java-bean
409
+ application/x-java-jnlp-file jnlp
410
+ application/x-javascript js
411
+ application/x-jmol jmz
412
+ application/x-kchart chrt
413
+ application/x-kdelnk
414
+ application/x-killustrator kil
415
+ application/x-koan skp skd skt skm
416
+ application/x-kpresenter kpr kpt
417
+ application/x-kspread ksp
418
+ application/x-kword kwd kwt
419
+ application/x-latex latex
420
+ application/x-lha lha
421
+ application/x-lyx lyx
422
+ application/x-lzh lzh
423
+ application/x-lzx lzx
424
+ application/x-maker frm maker frame fm fb book fbdoc
425
+ application/x-mif mif
426
+ application/x-ms-wmd wmd
427
+ application/x-ms-wmz wmz
428
+ application/x-msdos-program com exe bat dll
429
+ application/x-msi msi
430
+ application/x-netcdf nc
431
+ application/x-ns-proxy-autoconfig pac
432
+ application/x-nwc nwc
433
+ application/x-object o
434
+ application/x-oz-application oza
435
+ application/x-pkcs7-certreqresp p7r
436
+ application/x-pkcs7-crl crl
437
+ application/x-python-code pyc pyo
438
+ application/x-quicktimeplayer qtl
439
+ application/x-redhat-package-manager rpm
440
+ application/x-rx
441
+ application/x-sh sh
442
+ application/x-shar shar
443
+ application/x-shellscript
444
+ application/x-shockwave-flash swf swfl
445
+ application/x-stuffit sit sitx
446
+ application/x-sv4cpio sv4cpio
447
+ application/x-sv4crc sv4crc
448
+ application/x-tar tar
449
+ application/x-tcl tcl
450
+ application/x-tex-gf gf
451
+ application/x-tex-pk pk
452
+ application/x-texinfo texinfo texi
453
+ application/x-trash ~ % bak old sik
454
+ application/x-troff t tr roff
455
+ application/x-troff-man man
456
+ application/x-troff-me me
457
+ application/x-troff-ms ms
458
+ application/x-ustar ustar
459
+ application/x-videolan
460
+ application/x-wais-source src
461
+ application/x-wingz wz
462
+ application/x-x509-ca-cert crt
463
+ application/x-xcf xcf
464
+ application/x-xfig fig
465
+ application/x-xpinstall xpi
466
+
467
+ audio/32kadpcm
468
+ audio/3gpp
469
+ audio/basic au snd
470
+ audio/g.722.1
471
+ audio/l16
472
+ audio/midi mid midi kar
473
+ audio/mp4a-latm
474
+ audio/mpa-robust
475
+ audio/mpeg mpga mpega mp2 mp3 m4a
476
+ audio/mpegurl m3u
477
+ audio/ogg oga spx
478
+ audio/parityfec
479
+ audio/prs.sid sid
480
+ audio/telephone-event
481
+ audio/tone
482
+ audio/vnd.cisco.nse
483
+ audio/vnd.cns.anp1
484
+ audio/vnd.cns.inf1
485
+ audio/vnd.digital-winds
486
+ audio/vnd.everad.plj
487
+ audio/vnd.lucent.voice
488
+ audio/vnd.nortel.vbk
489
+ audio/vnd.nuera.ecelp4800
490
+ audio/vnd.nuera.ecelp7470
491
+ audio/vnd.nuera.ecelp9600
492
+ audio/vnd.octel.sbc
493
+ audio/vnd.qcelp
494
+ audio/vnd.rhetorex.32kadpcm
495
+ audio/vnd.vmx.cvsd
496
+ audio/x-aiff aif aiff aifc
497
+ audio/x-gsm gsm
498
+ audio/x-mpegurl m3u
499
+ audio/x-ms-wma wma
500
+ audio/x-ms-wax wax
501
+ audio/x-pn-realaudio-plugin
502
+ audio/x-pn-realaudio ra rm ram
503
+ audio/x-realaudio ra
504
+ audio/x-scpls pls
505
+ audio/x-sd2 sd2
506
+ audio/x-wav wav
507
+
508
+ chemical/x-alchemy alc
509
+ chemical/x-cache cac cache
510
+ chemical/x-cache-csf csf
511
+ chemical/x-cactvs-binary cbin cascii ctab
512
+ chemical/x-cdx cdx
513
+ chemical/x-cerius cer
514
+ chemical/x-chem3d c3d
515
+ chemical/x-chemdraw chm
516
+ chemical/x-cif cif
517
+ chemical/x-cmdf cmdf
518
+ chemical/x-cml cml
519
+ chemical/x-compass cpa
520
+ chemical/x-crossfire bsd
521
+ chemical/x-csml csml csm
522
+ chemical/x-ctx ctx
523
+ chemical/x-cxf cxf cef
524
+ #chemical/x-daylight-smiles smi
525
+ chemical/x-embl-dl-nucleotide emb embl
526
+ chemical/x-galactic-spc spc
527
+ chemical/x-gamess-input inp gam gamin
528
+ chemical/x-gaussian-checkpoint fch fchk
529
+ chemical/x-gaussian-cube cub
530
+ chemical/x-gaussian-input gau gjc gjf
531
+ chemical/x-gaussian-log gal
532
+ chemical/x-gcg8-sequence gcg
533
+ chemical/x-genbank gen
534
+ chemical/x-hin hin
535
+ chemical/x-isostar istr ist
536
+ chemical/x-jcamp-dx jdx dx
537
+ chemical/x-kinemage kin
538
+ chemical/x-macmolecule mcm
539
+ chemical/x-macromodel-input mmd mmod
540
+ chemical/x-mdl-molfile mol
541
+ chemical/x-mdl-rdfile rd
542
+ chemical/x-mdl-rxnfile rxn
543
+ chemical/x-mdl-sdfile sd sdf
544
+ chemical/x-mdl-tgf tgf
545
+ #chemical/x-mif mif
546
+ chemical/x-mmcif mcif
547
+ chemical/x-mol2 mol2
548
+ chemical/x-molconn-Z b
549
+ chemical/x-mopac-graph gpt
550
+ chemical/x-mopac-input mop mopcrt mpc dat zmt
551
+ chemical/x-mopac-out moo
552
+ chemical/x-mopac-vib mvb
553
+ chemical/x-ncbi-asn1 asn
554
+ chemical/x-ncbi-asn1-ascii prt ent
555
+ chemical/x-ncbi-asn1-binary val aso
556
+ chemical/x-ncbi-asn1-spec asn
557
+ chemical/x-pdb pdb ent
558
+ chemical/x-rosdal ros
559
+ chemical/x-swissprot sw
560
+ chemical/x-vamas-iso14976 vms
561
+ chemical/x-vmd vmd
562
+ chemical/x-xtel xtel
563
+ chemical/x-xyz xyz
564
+
565
+ image/cgm
566
+ image/g3fax
567
+ image/gif gif
568
+ image/ief ief
569
+ image/jpeg jpeg jpg jpe
570
+ image/naplps
571
+ image/pcx pcx
572
+ image/png png
573
+ image/prs.btif
574
+ image/prs.pti
575
+ image/svg+xml svg svgz
576
+ image/tiff tiff tif
577
+ image/vnd.cns.inf2
578
+ image/vnd.djvu djvu djv
579
+ image/vnd.dwg
580
+ image/vnd.dxf
581
+ image/vnd.fastbidsheet
582
+ image/vnd.fpx
583
+ image/vnd.fst
584
+ image/vnd.fujixerox.edmics-mmr
585
+ image/vnd.fujixerox.edmics-rlc
586
+ image/vnd.mix
587
+ image/vnd.net-fpx
588
+ image/vnd.svf
589
+ image/vnd.wap.wbmp wbmp
590
+ image/vnd.xiff
591
+ image/x-cmu-raster ras
592
+ image/x-coreldraw cdr
593
+ image/x-coreldrawpattern pat
594
+ image/x-coreldrawtemplate cdt
595
+ image/x-corelphotopaint cpt
596
+ image/x-icon ico
597
+ image/x-jg art
598
+ image/x-jng jng
599
+ image/x-ms-bmp bmp
600
+ image/x-photoshop psd
601
+ image/x-portable-anymap pnm
602
+ image/x-portable-bitmap pbm
603
+ image/x-portable-graymap pgm
604
+ image/x-portable-pixmap ppm
605
+ image/x-rgb rgb
606
+ image/x-xbitmap xbm
607
+ image/x-xpixmap xpm
608
+ image/x-xwindowdump xwd
609
+
610
+ inode/chardevice
611
+ inode/blockdevice
612
+ inode/directory-locked
613
+ inode/directory
614
+ inode/fifo
615
+ inode/socket
616
+
617
+ message/delivery-status
618
+ message/disposition-notification
619
+ message/external-body
620
+ message/http
621
+ message/s-http
622
+ message/news
623
+ message/partial
624
+ message/rfc822 eml
625
+
626
+ model/iges igs iges
627
+ model/mesh msh mesh silo
628
+ model/vnd.dwf
629
+ model/vnd.flatland.3dml
630
+ model/vnd.gdl
631
+ model/vnd.gs-gdl
632
+ model/vnd.gtw
633
+ model/vnd.mts
634
+ model/vnd.vtu
635
+ model/vrml wrl vrml
636
+
637
+ multipart/alternative
638
+ multipart/appledouble
639
+ multipart/byteranges
640
+ multipart/digest
641
+ multipart/encrypted
642
+ multipart/form-data
643
+ multipart/header-set
644
+ multipart/mixed
645
+ multipart/parallel
646
+ multipart/related
647
+ multipart/report
648
+ multipart/signed
649
+ multipart/voice-message
650
+
651
+ text/calendar ics icz
652
+ text/css css
653
+ text/csv csv
654
+ text/directory
655
+ text/english
656
+ text/enriched
657
+ text/h323 323
658
+ text/html html htm shtml
659
+ text/iuls uls
660
+ text/mathml mml
661
+ text/parityfec
662
+ text/plain asc txt text pot
663
+ text/prs.lines.tag
664
+ text/rfc822-headers
665
+ text/richtext rtx
666
+ text/rtf
667
+ text/scriptlet sct wsc
668
+ text/t140
669
+ text/texmacs tm ts
670
+ text/tab-separated-values tsv
671
+ text/uri-list
672
+ text/vnd.abc
673
+ text/vnd.curl
674
+ text/vnd.DMClientScript
675
+ text/vnd.flatland.3dml
676
+ text/vnd.fly
677
+ text/vnd.fmi.flexstor
678
+ text/vnd.in3d.3dml
679
+ text/vnd.in3d.spot
680
+ text/vnd.IPTC.NewsML
681
+ text/vnd.IPTC.NITF
682
+ text/vnd.latex-z
683
+ text/vnd.motorola.reflex
684
+ text/vnd.ms-mediapackage
685
+ text/vnd.sun.j2me.app-descriptor jad
686
+ text/vnd.wap.si
687
+ text/vnd.wap.sl
688
+ text/vnd.wap.wml wml
689
+ text/vnd.wap.wmlscript wmls
690
+ text/x-bibtex bib
691
+ text/x-boo boo
692
+ text/x-c++hdr h++ hpp hxx hh
693
+ text/x-c++src c++ cpp cxx cc
694
+ text/x-chdr h
695
+ text/x-component htc
696
+ text/x-crontab
697
+ text/x-csh csh
698
+ text/x-csrc c
699
+ text/x-dsrc d
700
+ text/x-diff diff patch
701
+ text/x-haskell hs
702
+ text/x-java java
703
+ text/x-literate-haskell lhs
704
+ text/x-makefile
705
+ text/x-moc moc
706
+ text/x-pascal p pas
707
+ text/x-pcs-gcd gcd
708
+ text/x-perl pl pm
709
+ text/x-python py
710
+ text/x-server-parsed-html
711
+ text/x-setext etx
712
+ text/x-sh sh
713
+ text/x-tcl tcl tk
714
+ text/x-tex tex ltx sty cls
715
+ text/x-vcalendar vcs
716
+ text/x-vcard vcf
717
+
718
+ video/3gpp 3gp
719
+ video/dl dl
720
+ video/dv dif dv
721
+ video/fli fli
722
+ video/gl gl
723
+ video/mpeg mpeg mpg mpe
724
+ video/mp4 mp4
725
+ video/ogg ogv
726
+ video/quicktime qt mov
727
+ video/mp4v-es
728
+ video/parityfec
729
+ video/pointer
730
+ video/vnd.fvt
731
+ video/vnd.motorola.video
732
+ video/vnd.motorola.videop
733
+ video/vnd.mpegurl mxu
734
+ video/vnd.mts
735
+ video/vnd.nokia.interleaved-multimedia
736
+ video/vnd.vivo
737
+ video/x-la-asf lsf lsx
738
+ video/x-mng mng
739
+ video/x-ms-asf asf asx
740
+ video/x-ms-wm wm
741
+ video/x-ms-wmv wmv
742
+ video/x-ms-wmx wmx
743
+ video/x-ms-wvx wvx
744
+ video/x-msvideo avi
745
+ video/x-sgi-movie movie
746
+
747
+ x-conference/x-cooltalk ice
748
+
749
+ x-epoc/x-sisx-app sisx
750
+ x-world/x-vrml vrm vrml wrl
751
+
752
+ video/x-flv flv
data/lib/mime_typer.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'webrick/httputils'
2
+
3
+ class MimeTyper
4
+ DEFAULT_MIME_TYPES_FILE = "/etc/mime.types"
5
+ BUILTIN_MIME_TYPES_FILE = File.expand_path(File.join(File.dirname(__FILE__), "mime.types"))
6
+ @@mime_types_file = File.exist?(DEFAULT_MIME_TYPES_FILE) ? DEFAULT_MIME_TYPES_FILE : BUILTIN_MIME_TYPES_FILE
7
+
8
+
9
+ # Allows setting mime.types file to be used
10
+ def self.mime_types_file=(path)
11
+ @@mime_types_file = path
12
+ @@mime_types ||= WEBrick::HTTPUtils.load_mime_types(@@mime_types_file)
13
+ end
14
+
15
+ # Returns the path to the mime.types file used by MimeTyper
16
+ def self.mime_types_file
17
+ @@mime_types_file
18
+ end
19
+
20
+ # Return the MIME type for the given filename
21
+ def self.type_for(filename)
22
+ @@mime_types ||= WEBrick::HTTPUtils.load_mime_types(@@mime_types_file)
23
+ WEBrick::HTTPUtils.mime_type(filename, @@mime_types)
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mime_typer
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ version: "0.1"
9
+ platform: ruby
10
+ authors:
11
+ - Eric Mason
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2011-06-21 00:00:00 -04:00
17
+ default_executable:
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: rspec
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ segments:
27
+ - 0
28
+ version: "0"
29
+ type: :development
30
+ version_requirements: *id001
31
+ description:
32
+ email: eric@ericmason.net
33
+ executables: []
34
+
35
+ extensions: []
36
+
37
+ extra_rdoc_files: []
38
+
39
+ files:
40
+ - lib/mime.types
41
+ - lib/mime_typer.rb
42
+ - Rakefile
43
+ - README.rdoc
44
+ has_rdoc: true
45
+ homepage: https://github.com/ericmason/mime_typer
46
+ licenses: []
47
+
48
+ post_install_message:
49
+ rdoc_options: []
50
+
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ requirements:
68
+ - none
69
+ rubyforge_project:
70
+ rubygems_version: 1.3.6
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Simple and compact gem to look up MIME types based on your system's mime.types file or one you specify.
74
+ test_files: []
75
+