mini_mime 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +4 -5
- data/bench/bench.rb +2 -2
- data/lib/db/content_type_mime.db +10 -11
- data/lib/db/ext_mime.db +25 -16
- data/lib/mini_mime.rb +14 -11
- data/lib/mini_mime/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6418281c1f9518b9e7afc48f4243db64e69b2b7102f7b5b75ef6222cc71597a7
|
4
|
+
data.tar.gz: 98a2802a299bea38149948706d8375211be7de314af5afcbf6fd07d50c185c06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ced08523dacb58cd959d3ad4f54b331e6b7332682166477e9a32e5dbd8583071e27c10d6b2c570db29d2d736579c13404d85589466d330de41862faf7c630c63
|
7
|
+
data.tar.gz: eca14d12f6b9a1408f8754fc59fc10faa0440b34ed0e7ade60d3114ec2ab933dab453fbfa1ae1ac63b765538710d31a224b1d195637c631c1725542f320083dc
|
data/CHANGELOG
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2016
|
3
|
+
Copyright (c) 2016 Discourse Construction Kit, Inc.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -49,22 +49,22 @@ Total retained: 7784 bytes (62 objects)
|
|
49
49
|
Warming up --------------------------------------
|
50
50
|
cached content_type lookup MiniMime
|
51
51
|
52.136k i/100ms
|
52
|
-
content_type lookup
|
52
|
+
content_type lookup MIME::Types
|
53
53
|
32.701k i/100ms
|
54
54
|
Calculating -------------------------------------
|
55
55
|
cached content_type lookup MiniMime
|
56
56
|
641.305k (± 3.2%) i/s - 3.232M in 5.045630s
|
57
|
-
content_type lookup
|
57
|
+
content_type lookup MIME::Types
|
58
58
|
361.041k (± 1.5%) i/s - 1.831M in 5.073290s
|
59
59
|
Warming up --------------------------------------
|
60
60
|
uncached content_type lookup MiniMime
|
61
61
|
3.333k i/100ms
|
62
|
-
content_type lookup
|
62
|
+
content_type lookup MIME::Types
|
63
63
|
33.177k i/100ms
|
64
64
|
Calculating -------------------------------------
|
65
65
|
uncached content_type lookup MiniMime
|
66
66
|
33.660k (± 1.7%) i/s - 169.983k in 5.051415s
|
67
|
-
content_type lookup
|
67
|
+
content_type lookup MIME::Types
|
68
68
|
364.931k (± 2.8%) i/s - 1.825M in 5.004112s
|
69
69
|
```
|
70
70
|
|
@@ -93,4 +93,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/discou
|
|
93
93
|
## License
|
94
94
|
|
95
95
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
96
|
-
|
data/bench/bench.rb
CHANGED
@@ -28,7 +28,7 @@ Benchmark.ips do |bm|
|
|
28
28
|
MiniMime.lookup_by_filename("a.txt").content_type
|
29
29
|
end
|
30
30
|
|
31
|
-
bm.report 'content_type lookup
|
31
|
+
bm.report 'content_type lookup MIME::Types' do
|
32
32
|
MIME::Types.type_for("a.txt")[0].content_type
|
33
33
|
end
|
34
34
|
end
|
@@ -46,7 +46,7 @@ Benchmark.ips do |bm|
|
|
46
46
|
MiniMime.lookup_by_filename("a.txt").content_type
|
47
47
|
end
|
48
48
|
|
49
|
-
bm.report 'content_type lookup
|
49
|
+
bm.report 'content_type lookup MIME::Types' do
|
50
50
|
MIME::Types.type_for("a.txt")[0].content_type
|
51
51
|
end
|
52
52
|
end
|
data/lib/db/content_type_mime.db
CHANGED
@@ -19,9 +19,7 @@ ecma application/ecmascript
|
|
19
19
|
emma application/emma+xml base64
|
20
20
|
epub application/epub+zip base64
|
21
21
|
exi application/exi base64
|
22
|
-
otf application/font-sfnt base64
|
23
22
|
pfr application/font-tdpfr base64
|
24
|
-
woff application/font-woff base64
|
25
23
|
gml application/gml+xml base64
|
26
24
|
gpx application/gpx+xml base64
|
27
25
|
gxf application/gxf base64
|
@@ -31,7 +29,6 @@ ink application/inkml+xml
|
|
31
29
|
ipfix application/ipfix base64
|
32
30
|
jar application/java-archive base64
|
33
31
|
ser application/java-serialized-object base64
|
34
|
-
class application/java-vm base64
|
35
32
|
js application/javascript 8bit
|
36
33
|
json application/json 8bit
|
37
34
|
jsonml application/jsonml+json base64
|
@@ -75,7 +72,6 @@ pkipath application/pkix-pkipath
|
|
75
72
|
pki application/pkixcmp base64
|
76
73
|
pls application/pls+xml base64
|
77
74
|
ai application/postscript 8bit
|
78
|
-
ppt application/powerpoint base64
|
79
75
|
cw application/prs.cww base64
|
80
76
|
rnd application/prs.nprend base64
|
81
77
|
pskcxml application/pskc+xml base64
|
@@ -325,6 +321,7 @@ thmx application/vnd.ms-officetheme
|
|
325
321
|
msg application/vnd.ms-outlook base64
|
326
322
|
cat application/vnd.ms-pki.seccat base64
|
327
323
|
stl application/vnd.ms-pki.stl base64
|
324
|
+
ppt application/vnd.ms-powerpoint base64
|
328
325
|
ppam application/vnd.ms-powerpoint.addin.macroEnabled.12 base64
|
329
326
|
pptm application/vnd.ms-powerpoint.presentation.macroEnabled.12 base64
|
330
327
|
sldm application/vnd.ms-powerpoint.slide.macroEnabled.12 base64
|
@@ -492,8 +489,7 @@ zaz application/vnd.zzazz.deck+xml
|
|
492
489
|
vxml application/voicexml+xml base64
|
493
490
|
wif application/watcherinfo+xml base64
|
494
491
|
wgt application/widget base64
|
495
|
-
|
496
|
-
wp application/wordperfect5.1 base64
|
492
|
+
wp5 application/wordperfect5.1 base64
|
497
493
|
wsdl application/wsdl+xml base64
|
498
494
|
wspolicy application/wspolicy+xml base64
|
499
495
|
wk application/x-123 base64
|
@@ -538,7 +534,6 @@ gsf application/x-font-ghostscript
|
|
538
534
|
psf application/x-font-linux-psf base64
|
539
535
|
pcf application/x-font-pcf base64
|
540
536
|
snf application/x-font-snf base64
|
541
|
-
ttc application/x-font-ttf base64
|
542
537
|
afm application/x-font-type1 base64
|
543
538
|
arc application/x-freearc base64
|
544
539
|
spl application/x-futuresplash base64
|
@@ -569,7 +564,7 @@ lnk application/x-ms-shortcut
|
|
569
564
|
wmd application/x-ms-wmd base64
|
570
565
|
wmz application/x-ms-wmz base64
|
571
566
|
xbap application/x-ms-xbap base64
|
572
|
-
|
567
|
+
mda application/x-msaccess base64
|
573
568
|
obd application/x-msbinder base64
|
574
569
|
crd application/x-mscardfile base64
|
575
570
|
clp application/x-msclip base64
|
@@ -615,9 +610,6 @@ tfm application/x-tex-tfm
|
|
615
610
|
texinfo application/x-texinfo 8bit
|
616
611
|
obj application/x-tgif base64
|
617
612
|
tbk application/x-toolbook base64
|
618
|
-
man application/x-troff-man 8bit
|
619
|
-
me application/x-troff-me base64
|
620
|
-
ms application/x-troff-ms base64
|
621
613
|
ustar application/x-ustar base64
|
622
614
|
src application/x-wais-source base64
|
623
615
|
webapp application/x-web-app-manifest+json base64
|
@@ -690,6 +682,11 @@ cif chemical/x-cif
|
|
690
682
|
cmdf chemical/x-cmdf base64
|
691
683
|
cml chemical/x-cml base64
|
692
684
|
csml chemical/x-csml base64
|
685
|
+
ttc font/collection base64
|
686
|
+
otf font/otf base64
|
687
|
+
ttf font/ttf base64
|
688
|
+
woff font/woff base64
|
689
|
+
woff2 font/woff2 base64
|
693
690
|
cgm image/cgm base64
|
694
691
|
g3 image/g3fax base64
|
695
692
|
gif image/gif base64
|
@@ -765,6 +762,7 @@ ics text/calendar
|
|
765
762
|
css text/css 8bit
|
766
763
|
csv text/csv 8bit
|
767
764
|
html text/html 8bit
|
765
|
+
markdown text/markdown quoted-printable
|
768
766
|
n3 text/n3 quoted-printable
|
769
767
|
txt text/plain quoted-printable
|
770
768
|
dsc text/prs.lines.tag quoted-printable
|
@@ -804,6 +802,7 @@ uu text/x-uuencode
|
|
804
802
|
vcs text/x-vcalendar 8bit
|
805
803
|
vcf text/x-vcard 8bit
|
806
804
|
yaml text/x-yaml 8bit
|
805
|
+
xml text/xml 8bit
|
807
806
|
3gp video/3gpp base64
|
808
807
|
3g2 video/3gpp2 base64
|
809
808
|
dv video/DV base64
|
data/lib/db/ext_mime.db
CHANGED
@@ -120,13 +120,14 @@ cif chemical/x-cif
|
|
120
120
|
cii application/vnd.anser-web-certificate-issue-initiation base64
|
121
121
|
cil application/vnd.ms-artgalry base64
|
122
122
|
cla application/vnd.claymore base64
|
123
|
-
class application/
|
123
|
+
class application/octet-stream base64
|
124
124
|
clkk application/vnd.crick.clicker.keyboard base64
|
125
125
|
clkp application/vnd.crick.clicker.palette base64
|
126
126
|
clkt application/vnd.crick.clicker.template base64
|
127
127
|
clkw application/vnd.crick.clicker.wordbank base64
|
128
128
|
clkx application/vnd.crick.clicker base64
|
129
129
|
clp application/x-msclip base64
|
130
|
+
clpi video/MP2T base64
|
130
131
|
cmc application/vnd.cosmocaller base64
|
131
132
|
cmd application/x-msdos-program base64
|
132
133
|
cmdf chemical/x-cmdf base64
|
@@ -137,6 +138,7 @@ cod application/vnd.rim.cod
|
|
137
138
|
coffee text/x-coffescript 8bit
|
138
139
|
com application/x-msdos-program base64
|
139
140
|
conf text/plain quoted-printable
|
141
|
+
cpi video/MP2T base64
|
140
142
|
cpio application/x-cpio base64
|
141
143
|
cpp text/plain quoted-printable
|
142
144
|
cpt application/x-mac-compactpro base64
|
@@ -339,7 +341,7 @@ hbci application/vnd.hbci
|
|
339
341
|
hdf application/x-hdf base64
|
340
342
|
hep application/x-hep base64
|
341
343
|
hh text/plain quoted-printable
|
342
|
-
hlp
|
344
|
+
hlp text/plain quoted-printable
|
343
345
|
hpgl application/vnd.hp-HPGL base64
|
344
346
|
hpid application/vnd.hp-hpid base64
|
345
347
|
hpp text/plain quoted-printable
|
@@ -380,6 +382,7 @@ ink application/inkml+xml
|
|
380
382
|
inkml application/inkml+xml base64
|
381
383
|
install application/x-install-instructions base64
|
382
384
|
iota application/vnd.astraea-software.iota base64
|
385
|
+
ipa application/octet-stream base64
|
383
386
|
ipfix application/ipfix base64
|
384
387
|
ipk application/vnd.shana.informed.package base64
|
385
388
|
irm application/vnd.ibm.rights-management base64
|
@@ -407,7 +410,7 @@ jpgm image/jpm
|
|
407
410
|
jpgv video/JPEG base64
|
408
411
|
jpm image/jpm base64
|
409
412
|
jpx image/jpx base64
|
410
|
-
js application/
|
413
|
+
js application/ecmascript base64
|
411
414
|
json application/json 8bit
|
412
415
|
jsonml application/jsonml+json base64
|
413
416
|
kar audio/midi base64
|
@@ -457,6 +460,7 @@ m14 application/x-msmediaview
|
|
457
460
|
m1v video/mpeg base64
|
458
461
|
m21 application/mp21 base64
|
459
462
|
m2a audio/mpeg base64
|
463
|
+
m2ts video/MP2T base64
|
460
464
|
m2v video/mpeg base64
|
461
465
|
m3a audio/mpeg base64
|
462
466
|
m3u audio/x-mpegurl base64
|
@@ -468,10 +472,10 @@ ma application/mathematica
|
|
468
472
|
mads application/mads+xml base64
|
469
473
|
mag application/vnd.ecowin.chart base64
|
470
474
|
maker application/vnd.framemaker base64
|
471
|
-
man
|
475
|
+
man text/troff 8bit
|
472
476
|
manifest text/cache-manifest quoted-printable
|
473
477
|
mar application/octet-stream base64
|
474
|
-
markdown text/
|
478
|
+
markdown text/markdown quoted-printable
|
475
479
|
mathml application/mathml+xml base64
|
476
480
|
mb application/mathematica base64
|
477
481
|
mbk application/vnd.Mobius.MBK base64
|
@@ -479,13 +483,13 @@ mbox application/mbox
|
|
479
483
|
mc1 application/vnd.medcalcdata base64
|
480
484
|
mcd application/vnd.mcd base64
|
481
485
|
mcurl text/vnd.curl.mcurl quoted-printable
|
482
|
-
md text/
|
486
|
+
md text/markdown quoted-printable
|
483
487
|
mda application/x-msaccess base64
|
484
488
|
mdb application/x-msaccess base64
|
485
489
|
mde application/x-msaccess base64
|
486
490
|
mdf application/x-msaccess base64
|
487
491
|
mdi image/vnd.ms-modi base64
|
488
|
-
me
|
492
|
+
me text/troff 8bit
|
489
493
|
mesh model/mesh base64
|
490
494
|
meta4 application/metalink4+xml base64
|
491
495
|
metalink application/metalink+xml base64
|
@@ -503,8 +507,10 @@ mj2 video/MJ2
|
|
503
507
|
mjp2 video/MJ2 base64
|
504
508
|
mjpeg video/x-motion-jpeg base64
|
505
509
|
mjpg video/x-motion-jpeg base64
|
510
|
+
mjs application/ecmascript base64
|
506
511
|
mk3d video/x-matroska base64
|
507
512
|
mka audio/x-matroska base64
|
513
|
+
mkd text/markdown quoted-printable
|
508
514
|
mks video/x-matroska base64
|
509
515
|
mkv video/x-matroska base64
|
510
516
|
mlp application/vnd.dolby.mlp base64
|
@@ -533,6 +539,8 @@ mpg video/mpeg
|
|
533
539
|
mpg4 application/mp4 base64
|
534
540
|
mpga audio/mpeg base64
|
535
541
|
mpkg application/vnd.apple.installer+xml base64
|
542
|
+
mpl video/MP2T base64
|
543
|
+
mpls video/MP2T base64
|
536
544
|
mpm application/vnd.blueice.multipass base64
|
537
545
|
mpn application/vnd.mophun.application base64
|
538
546
|
mpp application/vnd.ms-project base64
|
@@ -541,7 +549,7 @@ mpy application/vnd.ibm.MiniPay
|
|
541
549
|
mqy application/vnd.Mobius.MQY base64
|
542
550
|
mrc application/marc base64
|
543
551
|
mrcx application/marcxml+xml base64
|
544
|
-
ms
|
552
|
+
ms text/troff 8bit
|
545
553
|
mscml application/mediaservercontrol+xml base64
|
546
554
|
mseed application/vnd.fdsn.mseed base64
|
547
555
|
mseq application/vnd.mseq base64
|
@@ -616,7 +624,7 @@ org application/vnd.lotus-organizer
|
|
616
624
|
osf application/vnd.yamaha.openscoreformat base64
|
617
625
|
osfpvg application/vnd.yamaha.openscoreformat.osfpvg+xml base64
|
618
626
|
otc application/vnd.oasis.opendocument.chart-template base64
|
619
|
-
otf
|
627
|
+
otf font/otf base64
|
620
628
|
otg application/vnd.oasis.opendocument.graphics-template base64
|
621
629
|
oth application/vnd.oasis.opendocument.text-web base64
|
622
630
|
oti application/vnd.oasis.opendocument.image-template base64
|
@@ -680,16 +688,16 @@ pml application/vnd.ctc-posml
|
|
680
688
|
png image/png base64
|
681
689
|
pnm image/x-portable-anymap base64
|
682
690
|
portpkg application/vnd.macports.portpkg base64
|
683
|
-
pot application/powerpoint
|
691
|
+
pot application/vnd.ms-powerpoint base64
|
684
692
|
potm application/vnd.ms-powerpoint.template.macroEnabled.12 base64
|
685
693
|
potx application/vnd.openxmlformats-officedocument.presentationml.template base64
|
686
694
|
ppam application/vnd.ms-powerpoint.addin.macroEnabled.12 base64
|
687
695
|
ppd application/vnd.cups-ppd base64
|
688
696
|
ppm image/x-portable-pixmap base64
|
689
|
-
pps application/powerpoint
|
697
|
+
pps application/vnd.ms-powerpoint base64
|
690
698
|
ppsm application/vnd.ms-powerpoint.slideshow.macroEnabled.12 base64
|
691
699
|
ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow base64
|
692
|
-
ppt application/powerpoint
|
700
|
+
ppt application/vnd.ms-powerpoint base64
|
693
701
|
pptm application/vnd.ms-powerpoint.presentation.macroEnabled.12 base64
|
694
702
|
pptx application/vnd.openxmlformats-officedocument.presentationml.presentation base64
|
695
703
|
pqa application/vnd.palm base64
|
@@ -951,8 +959,8 @@ troff text/troff
|
|
951
959
|
ts video/MP2T base64
|
952
960
|
tsd application/timestamped-data base64
|
953
961
|
tsv text/tab-separated-values quoted-printable
|
954
|
-
ttc
|
955
|
-
ttf
|
962
|
+
ttc font/collection base64
|
963
|
+
ttf font/ttf base64
|
956
964
|
ttl text/turtle quoted-printable
|
957
965
|
twd application/vnd.SimTech-MindMapper base64
|
958
966
|
twds application/vnd.SimTech-MindMapper base64
|
@@ -1056,8 +1064,8 @@ wmlsc application/vnd.wap.wmlscriptc
|
|
1056
1064
|
wmv audio/x-ms-wmv base64
|
1057
1065
|
wmx video/x-ms-wmx base64
|
1058
1066
|
wmz application/x-ms-wmz base64
|
1059
|
-
woff
|
1060
|
-
woff2
|
1067
|
+
woff font/woff base64
|
1068
|
+
woff2 font/woff2 base64
|
1061
1069
|
wp application/wordperfect5.1 base64
|
1062
1070
|
wp5 application/wordperfect5.1 base64
|
1063
1071
|
wp6 application/x-wordperfect6.1 base64
|
@@ -1131,6 +1139,7 @@ xpr application/vnd.is-xpr
|
|
1131
1139
|
xps application/vnd.ms-xpsdocument 8bit
|
1132
1140
|
xpw application/vnd.intercon.formnet base64
|
1133
1141
|
xpx application/vnd.intercon.formnet base64
|
1142
|
+
xsd text/xml 8bit
|
1134
1143
|
xsl application/xml 8bit
|
1135
1144
|
xslt application/xslt+xml base64
|
1136
1145
|
xsm application/vnd.syncml+xml base64
|
data/lib/mini_mime.rb
CHANGED
@@ -6,6 +6,10 @@ module MiniMime
|
|
6
6
|
Db.lookup_by_filename(filename)
|
7
7
|
end
|
8
8
|
|
9
|
+
def self.lookup_by_extension(extension)
|
10
|
+
Db.lookup_by_extension(extension)
|
11
|
+
end
|
12
|
+
|
9
13
|
def self.lookup_by_content_type(mime)
|
10
14
|
Db.lookup_by_content_type(mime)
|
11
15
|
end
|
@@ -39,17 +43,16 @@ module MiniMime
|
|
39
43
|
|
40
44
|
def self.lookup_by_filename(filename)
|
41
45
|
extension = File.extname(filename)
|
42
|
-
if extension
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
46
|
+
return if extension.empty?
|
47
|
+
extension = extension[1..-1]
|
48
|
+
extension.downcase!
|
49
|
+
lookup_by_extension(extension)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.lookup_by_extension(extension)
|
53
|
+
LOCK.synchronize do
|
54
|
+
@db ||= new
|
55
|
+
@db.lookup_by_extension(extension)
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
data/lib/mini_mime/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_mime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.6
|
98
|
+
rubygems_version: 2.7.6
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: A lightweight mime type lookup toy
|