New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 0.2.13 to 0.2.14

4

lib/mailparser.js

@@ -5,3 +5,3 @@

* @author <a href="mailto:andris@node.ee">Andris Reinman</a>
* @version 0.2.12
* @version 0.2.14
*/

@@ -718,3 +718,3 @@

}else if(this._currentNode.meta.transferEncoding == "base64"){
this._currentNode.content = mimelib.decodeBase64(this._currentNode.content, false, this._currentNode.meta.charset || this.options.defaultCharset || "iso-8859-1");
this._currentNode.content = mimelib.decodeBase64(this._currentNode.content, this._currentNode.meta.charset || this.options.defaultCharset || "iso-8859-1");
}else{

@@ -721,0 +721,0 @@ this._currentNode.content = this._encodeString(this._currentNode.content);

@@ -33,3 +33,3 @@ var Stream = require('stream').Stream,

checksum: this.checksum.digest("hex")
}
};
};

@@ -79,3 +79,3 @@

checksum: this.checksum.digest("hex")
}
};
};

@@ -101,3 +101,3 @@

if(this.charset.toLowerCase() == "binary"){
; // do nothing
// do nothing
}else if(this.charset.toLowerCase() != "utf-8"){

@@ -145,3 +145,3 @@ iconv = new Iconv('UTF-8', this.charset+"//TRANSLIT//IGNORE");

checksum: this.checksum.digest("hex")
}
};
};
{
"name": "mailparser",
"description": "Asynchronous and non-blocking parser for mime encoded e-mail messages",
"version": "0.2.13",
"version": "0.2.14",
"author" : "Andris Reinman",

@@ -6,0 +6,0 @@ "maintainers":[

@@ -1,2 +0,1 @@

MailParser

@@ -24,2 +23,6 @@ ==========

[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=andris9&url=https://github.com/andris9/mailparser&title=MailParser&language=&tags=github&category=software)
MailParser is not the fastest multipart parser though - it takes about 5 sec. to parse a 25MB e-mail (a letter with one large attachment), so there's some room for improvement.
Live Demo

@@ -190,2 +193,6 @@ ---------

## Docs
See autogenerated docs for the code [here](http://www.node.ee/jsdoc/symbols/MailParser.html).
## Issues

@@ -192,0 +199,0 @@

@@ -7,3 +7,3 @@ var MailParser = require("../lib/mailparser").MailParser,

exports["General"] = {
exports["General tests"] = {
"Many chunks": function(test){

@@ -67,3 +67,3 @@ var encodedText = "Content-Type: text/plain; charset=utf-8\r\n\r\nÕÄ\r\nÖÜ", // \r\nÕÄÖÜ

}
};

@@ -108,3 +108,3 @@ exports["Text encodings"] = {

mailparser.on("end", function(mail){
test.equal((mail.html || "").substr(-4), "ÕÄÖÜ");
test.equal((mail.html || "").substr(-4), "ÕÄÖÜ");
test.done();

@@ -123,3 +123,3 @@ });

mailparser.on("end", function(mail){
test.equal((mail.html || "").substr(-4), "ÕÄÖÜ");
test.equal((mail.html || "").substr(-4), "ÕÄÖÜ");
test.done();

@@ -152,7 +152,7 @@ });

}
}
};
exports["Binary attachment encodings"] = {
"Quoted-Printable": function(test){
var encodedText = "Content-Type: application/octet-stream\r\nContent-Transfer-Encoding: QUOTED-PRINTABLE\r\n\r\n=00=01=02=03",
var encodedText = "Content-Type: application/octet-stream\r\nContent-Transfer-Encoding: QUOTED-PRINTABLE\r\n\r\n=00=01=02=03=FD=FE=FF",
mail = new Buffer(encodedText, "utf-8");

@@ -163,3 +163,3 @@

mailparser.on("end", function(mail){
test.equal(Array.prototype.slice.apply(mail.attachments && mail.attachments[0] && mail.attachments[0].content && mail.attachments[0].content || []).join(","), "0,1,2,3");
test.equal(Array.prototype.slice.apply(mail.attachments && mail.attachments[0] && mail.attachments[0].content && mail.attachments[0].content || []).join(","), "0,1,2,3,253,254,255");
test.done();

@@ -169,3 +169,3 @@ });

"Base64": function(test){
var encodedText = "Content-Type: application/octet-stream\r\nContent-Transfer-Encoding: base64\r\n\r\nAAECAw==",
var encodedText = "Content-Type: application/octet-stream\r\nContent-Transfer-Encoding: base64\r\n\r\nAAECA/3+/w==",
mail = new Buffer(encodedText, "utf-8");

@@ -176,3 +176,3 @@

mailparser.on("end", function(mail){
test.equal(Array.prototype.slice.apply(mail.attachments && mail.attachments[0] && mail.attachments[0].content && mail.attachments[0].content || []).join(","), "0,1,2,3");
test.equal(Array.prototype.slice.apply(mail.attachments && mail.attachments[0] && mail.attachments[0].content && mail.attachments[0].content || []).join(","), "0,1,2,3,253,254,255");
test.done();

@@ -193,3 +193,3 @@ });

}
};

@@ -241,6 +241,17 @@ exports["Plaintext format"] = {

}
}
};
exports["Transfer encoding"] = {
"Quoted-Printable": function(test){
"Quoted-Printable Default charset": function(test){
var encodedText = "Content-type: text/plain\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n=D5=C4=D6=DC",
mail = new Buffer(encodedText, "utf-8");
var mailparser = new MailParser();
mailparser.end(mail);
mailparser.on("end", function(mail){
test.equal(mail.text, "ÕÄÖÜ");
test.done();
});
},
"Quoted-Printable UTF-8": function(test){
var encodedText = "Content-type: text/plain; charset=utf-8\r\nContent-Transfer-Encoding: QUOTED-PRINTABLE\r\n\r\n=C3=95=C3=84=C3=96=C3=9C",

@@ -256,3 +267,14 @@ mail = new Buffer(encodedText, "utf-8");

},
"Base64": function(test){
"Base64 Default charset": function(test){
var encodedText = "Content-type: text/plain\r\nContent-Transfer-Encoding: bAse64\r\n\r\n1cTW3A==",
mail = new Buffer(encodedText, "utf-8");
var mailparser = new MailParser();
mailparser.end(mail);
mailparser.on("end", function(mail){
test.equal(mail.text, "ÕÄÖÜ");
test.done();
});
},
"Base64 UTF-8": function(test){
var encodedText = "Content-type: text/plain; charset=utf-8\r\nContent-Transfer-Encoding: bAse64\r\n\r\nw5XDhMOWw5w=",

@@ -279,3 +301,15 @@ mail = new Buffer(encodedText, "utf-8");

},
"8bit": function(test){
"8bit Default charset": function(test){
var encodedText = "Content-type: text/plain\r\nContent-Transfer-Encoding: 8bit\r\n\r\nÕÄÖÜ",
textmap = encodedText.split('').map(function(chr){return chr.charCodeAt(0);}),
mail = new Buffer(textmap);
var mailparser = new MailParser();
mailparser.end(mail);
mailparser.on("end", function(mail){
test.equal(mail.text, "ÕÄÖÜ");
test.done();
});
},
"8bit UTF-8": function(test){
var encodedText = "Content-type: text/plain; charset=utf-8\r\nContent-Transfer-Encoding: 8bit\r\n\r\nÕÄÖÜ",

@@ -303,6 +337,5 @@ mail = new Buffer(encodedText, "utf-8");

}
};
}
exports["Multipart"] = {
exports["Multipart content"] = {
"Simple": function(test){

@@ -359,5 +392,5 @@ var encodedText = "Content-type: multipart/mixed; boundary=ABC\r\n\r\n--ABC\r\nContent-type: text/plain; charset=utf-8\r\n\r\nÕÄÖÜ\r\n--ABC--",

}
}
};
exports["Attachments"] = {
exports["Attachment info"] = {
"Included integrity": function(test){

@@ -422,2 +455,2 @@ var encodedText = "Content-type: multipart/mixed; boundary=ABC\r\n"+

}
}
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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