Gathering detailed insights and metrics for mime-kind
Gathering detailed insights and metrics for mime-kind
npm install mime-kind
Typescript
Module System
Min. Node Version
Node Version
NPM Version
97.3
Supply Chain
86.4
Quality
75.3
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
5,102,034
Last Day
4,082
Last Week
22,467
Last Month
83,384
Last Year
1,274,340
9 Stars
22 Commits
2 Forks
2 Watching
6 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
4.0.0
Package Id
mime-kind@4.0.0
Unpacked Size
8.67 kB
Size
3.32 kB
File Count
5
NPM Version
6.14.17
Node Version
14.20.0
Cumulative downloads
Total Downloads
Last day
-16.3%
4,082
Compared to previous day
Last week
-15.8%
22,467
Compared to previous week
Last month
-12.1%
83,384
Compared to previous month
Last year
1.9%
1,274,340
Compared to previous year
2
6
Detect the MIME type of a Buffer
, Uint8Array
, ArrayBuffer
, ReadableStream
, file path and file name, with async
method.
1$ npm install mime-kind --save
1const { createReadStream } = require('fs'); 2const mime = require('mime-kind'); 3 4await mime('.fakeext'); // -> null 5await mime(createReadStream('./anonim.jpg')); // -> { ext: 'jpeg', mime: 'image/jpeg' } 6await mime('c:/anonim.jpeg'); // -> { ext: 'jpeg', mime: 'image/jpeg' }
Returns a Promise
with an object (or null
when no match) with:
ext
- file typemime
- the MIME typeThis methods supports all kind of ReadableStreams
.
Buffer
, Uint8Array
, ArrayBuffer
, ReadableStream
, file path or file name.String
or Object
with value which will be returned if no match will be found. If defaultValue
is incorrect returns null
.1const mime = require('mime-kind'); 2 3await mime('.fakeext', 'application/octet-stream'); // -> { ext: 'bin', mime: 'application/octet-stream' } 4await mime.async('.fakeext', { ext: 'mp4', mime: 'video/mp4' }); // -> { ext: 'mp4', mime: 'video/mp4' } 5await mime.async('.fakeext', 'ogg'); // -> { ext: 'ogg', mime: 'audio/ogg' } 6// but 7await mime.async('.fakeext', 'ogg3'); // -> null 8await mime('.fakeext', { ext: 'fake', mime: 'fake/fake' }); // -> null
With HTTP(S)
streams:
1const mime = require('mime-kind'); 2const { get } = require('https'); 3const { PassThrough } = require('stream'); 4 5const pass = new PassThrough(); 6get('https://avatars0.githubusercontent.com/u/2401029', res => res.pipe(pass)); 7await mime(pass); // -> { ext: 'jpg', mime: 'image/jpeg' }
The MIT License (MIT)
Copyright (c) 2015-2022 Alexey Bystrov
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
11 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-13
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