Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mailparser

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailparser - npm Package Compare versions

Comparing version 2.7.3 to 2.7.4

56

lib/mail-parser.js

@@ -16,2 +16,3 @@ 'use strict';

const tlds = require('tlds');
const encodingJapanese = require('encoding-japanese');

@@ -84,2 +85,42 @@ linkify

class JPDecoder extends Transform {
constructor(charset) {
super();
this.charset = charset;
this.chunks = [];
this.chunklen = 0;
}
_transform(chunk, encoding, done) {
if (typeof chunk === 'string') {
chunk = Buffer.from(chunk, encoding);
}
this.chunks.push(chunk);
this.chunklen += chunk.length;
done();
}
_flush(done) {
let input = Buffer.concat(this.chunks, this.chunklen);
try {
let output = encodingJapanese.convert(input, {
to: 'UNICODE', // to_encoding
from: this.charset, // from_encoding
type: 'string'
});
if (typeof output === 'string') {
output = Buffer.from(output);
}
this.push(output);
} catch (err) {
// keep as is on errors
this.push(input);
}
done();
}
}
class MailParser extends Transform {

@@ -157,3 +198,16 @@ constructor(config) {

} else {
return iconv;
return {
decodeStream(charset) {
charset = (charset || 'ascii')
.toString()
.trim()
.toLowerCase();
if (/^jis|^iso-?2022-?jp|^EUCJP/i.test(charset)) {
// special case not supported by iconv-lite
return new JPDecoder(charset);
}
return iconv.decodeStream(charset);
}
};
}

@@ -160,0 +214,0 @@ }

5

package.json
{
"name": "mailparser",
"version": "2.7.3",
"version": "2.7.4",
"description": "Parse e-mails",

@@ -19,6 +19,7 @@ "main": "index.js",

"dependencies": {
"encoding-japanese": "1.0.30",
"he": "1.2.0",
"html-to-text": "5.1.1",
"iconv-lite": "0.5.0",
"libmime": "4.1.4",
"libmime": "4.2.1",
"linkify-it": "2.2.0",

@@ -25,0 +26,0 @@ "mailsplit": "4.4.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc