mime-lib

MIME related utility functions

MIME Library

Install via npm

$ npm install mime-lib
mime.type('html')        // => text/html 
mime.type('mp4')         // => video/mp4 
mime.type('nonexistant') // => application/octet-stream 
mime.extension('text/html')   // => [ 'htm', 'html' ] 
mime.extension('nonexistant') // =>  

String | Buffer input
String charset (optional)

Base64 encodes a buffer or string.
Returns string.

String input
String charset (optional)

Decodes a base64 encoded string.
Returns string or buffer.

String input
Boolean multibyte (optional)
Boolean wordMode (optional)

Encodes a string into Quoted-printable format.
Returns string.

String input
Boolean multibyte (optional)
Boolean wordMode (optional)

Decodes a string from Quoted-printable format.
Returns string.

String input
String type (optional)
String charset (optional)

Encodes a string into mime encoded word format.
Returns string.

String input

Decodes a string from mime encoded word format.
Returns string.

String input
Number maxLength (optional)
Boolean hardWrap (optional)

Folds a long line according to the RFC 5322.
Returns string.