This package has been deprecated

Author message:

This package has been deprecated

@saekitominaga/mime-parser
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

Parsing a MIME type

npm version test status

Examples

import MIMETypeParser from '@saekitominaga/mime-parser';

const mimeTypeParser = new MIMETypeParser('Text/HTML; Charset=utf-8');
mimeTypeParser.toString(); // 'text/html;charset=utf-8'
mimeTypeParser.getType(); // 'text'
mimeTypeParser.getSubtype(); // 'html'
mimeTypeParser.getEssence(); // 'text/html'
mimeTypeParser.getParameters(); // Map(1) { 'charset' => 'utf-8' }
mimeTypeParser.getParameter('charset'); // 'utf-8'
mimeTypeParser.getParameter('foo'); // undefined

Constructor

new MIMETypeParser(inputMimeType: string)

Parameters

inputMimeType
MIME type value

Methods

toString(): string
Get the entire serialized MIME type string.
getType(): string
Get the type part of MIME type.
getSubtype(): string
Get the subtype part of MIME type.
getEssence(): string
Get the essence part (type/subtype) of MIME type.
getParameters(): Map<string, string>
Get the parameters part of MIME type.
getParameter(key: string): string | undefined
Get the value of parameters associated with the specified key of MIME type.

Readme

Keywords

Package Sidebar

Install

npm i @saekitominaga/mime-parser

Weekly Downloads

1

Version

1.2.4

License

MIT

Unpacked Size

49.1 kB

Total Files

7

Last publish

Collaborators

  • saekitominaga