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

libmime

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libmime - npm Package Compare versions

Comparing version
5.3.8
to
5.4.0
+7
-0
CHANGELOG.md
# Changelog
## [5.4.0](https://github.com/nodemailer/libmime/compare/v5.3.8...v5.4.0) (2026-06-25)
### Features
* expose normalizeCharset() on the public API ([f19e5dc](https://github.com/nodemailer/libmime/commit/f19e5dc6b5297e97e19286b95fc0521937bc166f))
## [5.3.8](https://github.com/nodemailer/libmime/compare/v5.3.7...v5.3.8) (2026-04-08)

@@ -4,0 +11,0 @@

+3
-2

@@ -91,3 +91,4 @@ 'use strict';

* Converts well known invalid character set names to proper names.
* eg. win-1257 will be converted to WINDOWS-1257
* eg. win-1257 will be converted to windows-1257. Missing or non-string
* input defaults to UTF-8.
*

@@ -98,3 +99,3 @@ * @param {String} charset Charset name to convert

normalizeCharset(charset) {
charset = charset.toLowerCase().trim();
charset = (charset || 'UTF-8').toString().toLowerCase().trim();

@@ -101,0 +102,0 @@ // first pass

@@ -199,2 +199,15 @@ /* eslint no-control-regex: 0, no-div-regex: 0, quotes: 0 */

/**
* Normalizes a charset name to its canonical form, resolving common aliases and
* invalid names. For example `iso-8859-8-i` and `iso-8859-8-e` become `ISO-8859-8`
* and `win-1257` becomes `windows-1257`. Unknown charsets are returned uppercased.
* Missing or non-string input defaults to `UTF-8`.
*
* @param {String} charset Charset name to normalize
* @return {String} Canonical charset name
*/
normalizeCharset(charset) {
return libcharset.normalizeCharset(charset);
}
/**
* Decodes the inner payload of a single mime encoded-word into a unicode string.

@@ -201,0 +214,0 @@ * Expects the three components of `=?charset?encoding?text?=` already separated.

+3
-3
{
"name": "libmime",
"description": "Encode and decode quoted printable and base64 strings",
"version": "5.3.8",
"version": "5.4.0",
"main": "lib/libmime.js",

@@ -36,8 +36,8 @@ "files": [

"eslint-config-prettier": "10.1.8",
"grunt": "1.6.1",
"grunt": "1.6.2",
"grunt-cli": "1.5.0",
"grunt-eslint": "24.3.0",
"grunt-mocha-test": "0.13.3",
"mocha": "11.7.5"
"mocha": "11.7.6"
}
}
# libmime
`libmime` provides useful MIME related functions. For Quoted-Printable and Base64 encoding and decoding see [libqp](https://github.com/andris9/libqp) and [libbase64](https://github.com/andris9/libabase64).
`libmime` provides useful MIME related functions. For Quoted-Printable and Base64 encoding and decoding see [libqp](https://github.com/andris9/libqp) and [libbase64](https://github.com/andris9/libbase64).

@@ -41,3 +41,3 @@ ## Installation

libmime.encodeWords(str[, mimeWordEncoding[, maxLength]) → String
libmime.encodeWords(str [, mimeWordEncoding[, maxLength[, fromCharset]]]) → String

@@ -47,2 +47,3 @@ * **str** - String or Buffer to be encoded

* **maxLength** - If set, split mime words into several chunks if needed
* **fromCharset** - Source character set of `str` (defaults to `'UTF-8'`)

@@ -71,3 +72,3 @@ #### #decodeWords

libmime.foldLines('Content-Type: multipart/alternative; boundary="----zzzz----"')
libmime.foldLines('Content-Type: multipart/alternative; boundary="----zzzz----"', 40)

@@ -77,3 +78,3 @@ results in

Content-Type: multipart/alternative;
boundary="----zzzz----"
boundary="----zzzz----"

@@ -130,3 +131,3 @@ #### #encodeFlowed

```javascript
parseHeaderValue('content-type: text/plain; CHARSET="UTF-8"');
parseHeaderValue('text/plain; CHARSET="UTF-8"');
```

@@ -159,7 +160,8 @@

libmime.buildHeaderParam(key, str, maxLength) → Array
libmime.buildHeaderParam(key, str [, maxLength[, fromCharset]]) → Array
* **key** - Parameter key (eg. `filename`)
* **str** - String or an Buffer value to encode
* **str** - String or a Buffer value to encode
* **maxLength** - Maximum length of the encoded string part (not line length). Defaults to 50
* **fromCharset** - Source character set of `str` when it is a Buffer (defaults to `'UTF-8'`)

@@ -166,0 +168,0 @@ The method returns an array of encoded parts with the following structure: `[{key:'...', value: '...'}]`