🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

bare-mime

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-mime

MIME type parsing for Bare

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
24K
37.97%
Maintainers
1
Weekly downloads
 
Created
Source

bare-mime

MIME type parsing for Bare, implementing the MIME type record and parser defined by the MIME Sniffing Standard at https://mimesniff.spec.whatwg.org.

npm i bare-mime

Usage

const MIME = require('bare-mime')

const mime = MIME.parse('text/plain;charset=utf-8')

console.log(mime.type) // 'text'
console.log(mime.subtype) // 'plain'
console.log(mime.parameters.get('charset')) // 'utf-8'

API

const mime = new MIME(type, subtype[, parameters])

Construct a new MIME type record with the given type and subtype strings. parameters is an optional Map of parameter name-value pairs, defaulting to an empty Map.

mime.type

The type of the MIME type record, e.g. 'text'.

mime.subtype

The subtype of the MIME type record, e.g. 'plain'.

mime.parameters

A Map of parameters associated with the MIME type record.

const mime = MIME.parse(input)

Parse a MIME type string per https://mimesniff.spec.whatwg.org/#parse-a-mime-type. Returns a MIME instance on success or null on failure. The type and subtype are lowercased and leading/trailing HTTP whitespace is stripped. Parameters are parsed from the input, with duplicate parameter names ignored in favor of the first occurrence.

License

Apache-2.0

FAQs

Package last updated on 27 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts