Skip to content

Commit bc8207a

Browse files
committed
v1.2.1
1 parent 86ee2a6 commit bc8207a

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

lib/libbase64.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,11 @@ class Encoder extends Transform {
113113
this.push(chunk);
114114
}
115115

116-
_getWrapped(str) {
117-
let prefix = '';
118-
116+
_getWrapped(str, isFinal) {
119117
str = wrap(str, this.options.lineLength);
120-
121-
if (prefix) {
122-
str = prefix + str;
118+
if (!isFinal && str.length === this.options.lineLength) {
119+
str += '\r\n';
123120
}
124-
125121
return str;
126122
}
127123

@@ -179,7 +175,7 @@ class Encoder extends Transform {
179175
}
180176

181177
if (this._curLine) {
182-
this._curLine = this._getWrapped(this._curLine);
178+
this._curLine = this._getWrapped(this._curLine, true);
183179
this._writeChunk(Buffer.from(this._curLine, 'ascii'), true);
184180
this._curLine = '';
185181
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "libbase64",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "Encode and decode base64 encoded strings",
55
"main": "lib/libbase64.js",
66
"scripts": {

0 commit comments

Comments
 (0)