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

mimelib

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

mimelib - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

2

content-types.js

@@ -60,2 +60,2 @@ // list of mime types

"rar": "application/x-rar-compressed"
}
};

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

try{
// see http://github.com/bnoordhuis/node-iconv for more info
var Iconv = require("iconv").Iconv;
}catch(E){
// convert nothing
Iconv = function(){}
Iconv.prototype.convert = function(buf){return buf;};
}
var Iconv = require("iconv").Iconv;

@@ -40,3 +33,3 @@ /* mime related functions - encoding/decoding etc*/

// read in <maxLength> bytes and try to fold it
while(line = str.substr(curpos, maxLength)){
while((line = str.substr(curpos, maxLength))){
if(!!foldAnywhere){

@@ -71,3 +64,3 @@ response += line;

return response;
}
};

@@ -103,3 +96,3 @@

return "=?"+charset+"?"+encoding+"?"+str+"?=";
}
};

@@ -132,3 +125,3 @@ /**

return text;
}
};

@@ -146,3 +139,3 @@

this.encodeQuotedPrintable = function(str, mimeWord, charset){
charset = charset || "UTF-8";
charset = charset || "UTF-8";

@@ -152,3 +145,3 @@ /*

* Spaces + tabs OK (except for line beginnings and endings)
* \n + \r OK
* \n + \r OK
*/

@@ -171,3 +164,3 @@

var lines = str.split(/\r?\n|\r/);
str.replace(/(.{73}(?!\r?\n|\r))/,"$&=\r\n")
//str.replace(/(.{73}(?!\r?\n|\r))/,"$&=\r\n")
for(var i=0, len = lines.length; i<len; i++){

@@ -188,3 +181,3 @@ if(lines[i].length>76){

return str;
}
};

@@ -205,9 +198,9 @@ /**

}else{
str = str.replace(/=(\r?\n|\r)/gm,'');
str = str.replace(/=$/,"");
str = str.replace(/\=(\r?\n|\r)/gm,'');
str = str.replace(/\=$/,"");
}
if(charset == "UTF-8")
str = decodeURIComponent(str.replace(/%/g,'%25').replace(/=/g,"%"));
str = decodeURIComponent(str.replace(/%/g,'%25').replace(/\=/g,"%"));
else{
str = str.replace(/%/g,'%25').replace(/=/g,"%");
str = str.replace(/%/g,'%25').replace(/\=/g,"%");
if(charset=="ISO-8859-1" || charset=="LATIN1")

@@ -221,3 +214,3 @@ str = unescape(str);

return str;
}
};

@@ -238,3 +231,3 @@ /**

return buffer.toString("base64");
}
};

@@ -258,3 +251,3 @@ /**

return buffer.toString("UTF-8");
}
};

@@ -288,3 +281,3 @@ /**

return header_lines;
}
};

@@ -301,7 +294,7 @@ /**

addresses = addresses.replace(/=\?[^?]+\?[QqBb]\?[^?]+\?=/g, (function(a){return this.decodeMimeWord(a)}).bind(this));
addresses = addresses.replace(/\=\?[^?]+\?[QqBb]\?[^?]+\?=/g, (function(a){return this.decodeMimeWord(a);}).bind(this));
// not sure if it's even needed - urlencode escaped \\ and \" and \'
addresses = addresses.replace(/\\\\/g,function(a){return escape(a.charAt(1))});
addresses = addresses.replace(/\\["']/g,function(a){return escape(a.charAt(1))});
addresses = addresses.replace(/\\\\/g,function(a){return escape(a.charAt(1));});
addresses = addresses.replace(/\\["']/g,function(a){return escape(a.charAt(1));});

@@ -382,6 +375,6 @@ // find qutoed strings

if(email)
addressArr.push({address:decodeURIComponent(email), name: decodeURIComponent(name || "")});
addressArr.push({address:decodeURIComponent(email), name: decodeURIComponent(name || "")});
}
return addressArr;
}
};

@@ -395,6 +388,6 @@ /**

this.parseMimeWords = function(str){
return str.replace(/=\?[^?]+\?[QqBb]\?[^?]+\?=/g, (function(a){
return str.replace(/\=\?[^?]+\?[QqBb]\?[^?]+\?=/g, (function(a){
return this.decodeMimeWord(a);
}).bind(this));
}
};

@@ -423,3 +416,3 @@ /**

return result;
}
};

@@ -456,4 +449,8 @@

function fromCharset(charset, buffer, keep_buffer){
var iconv = new Iconv(charset,'UTF-8'),
var iconv;
try{
iconv = new Iconv(charset, 'UTF-8//TRANSLIT//IGNORE');
buffer = iconv.convert(buffer);
}catch(E){}
return keep_buffer?buffer:buffer.toString("utf-8");

@@ -470,4 +467,9 @@ }

function toCharset(charset, buffer){
var iconv = new Iconv('UTF-8',charset);
return iconv.convert(buffer);
var iconv;
try{
iconv = new Iconv('UTF-8', charset+"//TRANSLIT//IGNORE");
return iconv.convert(buffer);
}catch(E){
return buffer;
}
}

@@ -485,7 +487,7 @@

function decodeBytestreamUrlencoding(encoded_string){
var c, i, j=0, prcnts = encoded_string.match(/%/g) || "",
var c, i, j=0, len, prcnts = encoded_string.match(/%/g) || "",
buffer_length = encoded_string.length - (prcnts.length*2),
buffer = new Buffer(buffer_length);
for(var i=0; i<encoded_string.length; i++){
for(i=0, len=encoded_string.length; i<len; i++){
c = encoded_string.charCodeAt(i);

@@ -492,0 +494,0 @@ if(c=="37"){ // %

{
"name": "mimelib",
"description": "MIME functions to encode/decode e-mails etc.",
"version": "0.1.5",
"version": "0.1.6",
"author" : "Andris Reinman",

@@ -6,0 +6,0 @@ "homepage":"http://github.com/andris9/mimelib",

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