Gathering detailed insights and metrics for mime-kind
Gathering detailed insights and metrics for mime-kind
Gathering detailed insights and metrics for mime-kind
Gathering detailed insights and metrics for mime-kind
Detect the mime type of a Buffer, ReadStream, file path and file name.
npm install mime-kind
Typescript
Module System
Min. Node Version
Node Version
NPM Version
94.3
Supply Chain
85.9
Quality
75.1
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
5,470,029
Last Day
600
Last Week
15,599
Last Month
69,969
Last Year
1,134,250
MIT License
9 Stars
22 Commits
2 Forks
1 Watchers
6 Branches
1 Contributors
Updated on Aug 07, 2024
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
-21.2%
600
Compared to previous day
Last Week
-11.7%
15,599
Compared to previous week
Last Month
-4.5%
69,969
Compared to previous month
Last Year
-14.5%
1,134,250
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 binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Found 0/18 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
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
security policy 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
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
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