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
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
9 Stars
22 Commits
2 Forks
1 Watchers
6 Branches
1 Contributors
Updated on Aug 07, 2024
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
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
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
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
Found 0/18 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
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-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