README
Parsing a MIME type
Examples
import MIMEParser from '@saekitominaga/mime-parser';
const mimeParser = new MIMEParser('Text/HTML; Charset=utf-8');
mimeParser.toString(); // 'text/html;charset=utf-8'
mimeParser.getType(); // 'text'
mimeParser.getSubtype(); // 'html'
mimeParser.getEssence(); // 'text/html'
mimeParser.getParameters(); // Map(1) { 'charset' => 'utf-8' }
mimeParser.getParameter('charset'); // 'utf-8'
mimeParser.getParameter('foo'); // undefined
Constructor
new MIMEParser(inputMime: string)
Parameters
- inputMime
- MIME type value
Methods
- toString(): string
- Get the entire serialized MIME type string.
- getType(): string
- Get the type part of MIME.
- getSubtype(): string
- Get the subtype part of MIME.
- getEssence(): string
- Get the essence part (type/subtype) of MIME.
- getParameters(): Map<string, string>
- Get the parameters part of MIME.
- getParameter(key: string): string | undefined
- Get the value of parameters associated with the specified key of MIME.