Gathering detailed insights and metrics for sniffy-mimetype
Gathering detailed insights and metrics for sniffy-mimetype
npm install sniffy-mimetype
Typescript
Module System
Node Version
NPM Version
71.4
Supply Chain
86.8
Quality
75.4
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
3,612
Last Day
1
Last Week
6
Last Month
41
Last Year
588
2 Stars
10 Commits
3 Watching
2 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.1.1
Package Id
sniffy-mimetype@1.1.1
Unpacked Size
11.23 kB
Size
3.61 kB
File Count
4
NPM Version
7.19.1
Node Version
16.5.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
50%
6
Compared to previous week
Last month
-41.4%
41
Compared to previous month
Last year
-25.6%
588
Compared to previous year
1
MIME Type string parser that tries to conform to the WHATWG MIME Sniff spec.
The MIMEType
class consists of:
constructor(string)
: takes a string representing a MIME type. This sends the string to the parser. If the string is non-conforming, it throws a TypeError
errors..essense
property: the "type", "/", and "subtype" normalized to lower case. For example: "text/plain"..type
: the primary type of the string. E.g., "application", "text", or "image"..subtype
: The subtype. So, like, "plain" in "text/plain"..parameters
: a Map consisting of the parameters that were passed, normalized per spec..toString()
: stringifier gives you back the MIME type in canonical form.Exported utilty methods
isValidMimeType(string)
- returns boolean, checks if a MIME type is valid by parsing it.parseMimeType(string)
- returns an object { type: string, subtype: string, params: object }
.1// As a class 2import { MIMEType } from "MIMEType"; 3// Or utility functions 4import { isValidMimeType, parseMimeType } from "MIMEType"; 5 6const mimetype = new MIMEType("text/html; charset=UTF-8"); 7 8// This throws 9try { 10 new MIMEType("not valid"); 11} catch (err) { 12 // nice try... 13}
1import { MIMEType } from "MIMEType"; 2const mimetype = new MIMEType("text/html; charset=UTF-8"); 3console.log(mimetype.essense); // text/html 4console.log(mimetype.type) // text 5console.log(mimetype.subtype) // html
Parameters is just a regular JavaScript Map, so:
1import { MIMEType } from "MIMEType"; 2const mimetype = new MIMEType("text/html; charset=UTF-8"); 3 4mimetype.parameters.has("charset"); // true 5 6for(const [key, value] of mimetype.parameters) { 7 console.log(key, value); 8}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
5 existing vulnerabilities detected
Details
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
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
Score
Last Scanned on 2024-12-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