Gathering detailed insights and metrics for mime-matcher
Gathering detailed insights and metrics for mime-matcher
Gathering detailed insights and metrics for mime-matcher
Gathering detailed insights and metrics for mime-matcher
MimeMatcher is very simple JavaScript library for checking if mime type string is in allowed range.
npm install mime-matcher
Typescript
Module System
Node Version
NPM Version
76.6
Supply Chain
99.6
Quality
75.3
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
180,069
Last Day
41
Last Week
984
Last Month
4,296
Last Year
70,643
6 Stars
23 Commits
2 Forks
1 Watchers
16 Branches
2 Contributors
Updated on Jun 20, 2025
Minified
Minified + Gzipped
Latest Version
1.0.5
Package Id
mime-matcher@1.0.5
Unpacked Size
81.02 kB
Size
21.78 kB
File Count
19
NPM Version
6.12.1
Node Version
12.13.1
Cumulative downloads
Total Downloads
Last Day
-42.3%
41
Compared to previous day
Last Week
-11.7%
984
Compared to previous week
Last Month
-28.7%
4,296
Compared to previous month
Last Year
232.9%
70,643
Compared to previous year
25
MimeMatcher is very simple library for checking if mime type string is in allowed range.
You can also match mime types against wildcards, like */*
or 'application/*'
You can install it from npm:
npm install mime-matcher --save
Or you can download mime-matcher.min.js
from the dist folder and then include it in html file:
1<script src="mime-matcher.min.js"></script>
1import MimeMatcher from 'mime-matcher' 2 3const matcher = new MimeMatcher('image/gif') 4 5matcher.match('image/gif') //true 6matcher.match('image/jpeg') //false
You can also use wildcards:
1import MimeMatcher from 'mime-matcher' 2 3new MimeMatcher('image/*').match('image/gif') //true 4new MimeMatcher('*/*').match('text/xml') //true 5
You can also use multiple mime types to match against:
1import MimeMatcher from 'mime-matcher' 2 3const matcher = new MimeMatcher('image/*', 'text/*') 4 5matcher.match('text/xml') //true 6matcher.match('image/gif') //true 7matcher.match('audio/mpeg') //false 8
Optional mime type parameter is ignored:
1import MimeMatcher from 'mime-matcher' 2 3const matcher = new MimeMatcher('text/xml') 4 5matcher.match('text/xml; encoding=utf-8') //true
You can also use higher-order function matcher
, which accepts expected types and returns another function, which you can use for matching:
1import { matcher } from 'mime-matcher' 2 3const m = matcher('text/*') 4m('text/xml') //true 5 6matcher('image/*', 'text/*')("image/gif") //true
There is also function parse
which returns object containing data of parsed mime-type:
1import { parse as parseMimeType } from 'mime-matcher' 2 3parseMimeType('application/json') 4/* 5{ 6 valid: true 7 type: "application", 8 subType: "json" 9} 10*/ 11 12parseMimeType('text/xml; encoding=utf-8') 13/* 14{ 15 valid: true 16 type: "text", 17 subType: "xml", 18 parameter: "encoding=utf-8" 19} 20*/ 21 22 23parseMimeType('invalid') 24/* 25{ 26 valid: false 27} 28*/ 29
You can also import function isValid
as shorthand for checking validity:
1import { isValid as isValidMimeType } from 'mime-matcher' 2 3isValidMimeType('text/xml') //true 4
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
84 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More