iconv-lite
Advanced tools
Comparing version 0.4.3 to 0.4.4
# 0.4.4 / 2014-07-16 | ||
* added encodings UTF-7 (RFC2152) and UTF-7-IMAP (RFC3501 Section 5.1.3) | ||
* fixed streaming base64 encoding | ||
# 0.4.3 / 2014-06-14 | ||
@@ -3,0 +8,0 @@ |
@@ -7,2 +7,3 @@ | ||
require("./utf16"), | ||
require("./utf7"), | ||
require("./sbcs-codec"), | ||
@@ -9,0 +10,0 @@ require("./sbcs-data"), |
@@ -23,3 +23,3 @@ | ||
return { | ||
encoder: encoderInternal, | ||
encoder: options.enc == "base64" ? encoderBase64 : encoderInternal, | ||
decoder: decoderInternal, | ||
@@ -43,2 +43,3 @@ | ||
// Encoder is mostly trivial | ||
@@ -58,1 +59,26 @@ function encoderInternal() { | ||
// Except base64 encoder, which must keep its state. | ||
function encoderBase64() { | ||
return { | ||
write: encodeBase64Write, | ||
end: encodeBase64End, | ||
prevStr: '', | ||
}; | ||
} | ||
function encodeBase64Write(str) { | ||
str = this.prevStr + str; | ||
var completeQuads = str.length - (str.length % 4); | ||
this.prevStr = str.slice(completeQuads); | ||
str = str.slice(0, completeQuads); | ||
return new Buffer(str, "base64"); | ||
} | ||
function encodeBase64End() { | ||
return new Buffer(this.prevStr, "base64"); | ||
} | ||
{ | ||
"name": "iconv-lite", | ||
"description": "Convert character encodings in pure javascript.", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ |
@@ -93,4 +93,4 @@ ## Pure JS character encoding conversion | ||
* All node.js native encodings: utf8, ucs2 / utf16, ascii, binary, base64, hex. | ||
* Additional unicode encodings: utf16, utf16-be. | ||
* All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex. | ||
* Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap. | ||
* All widespread singlebyte encodings: Windows 125x family, ISO-8859 family, | ||
@@ -97,0 +97,0 @@ IBM/DOS codepages, Macintosh family, KOI8 family, all others supported by iconv library. |
324172
27
3801