libbase64 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/libbase64.js +4 -8
- package/package.json +1 -1
package/lib/libbase64.js
CHANGED
|
@@ -113,15 +113,11 @@ class Encoder extends Transform {
|
|
|
113
113
|
this.push(chunk);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
_getWrapped(str) {
|
|
117
|
-
let prefix = '';
|
|
118
|
-
|
|
116
|
+
_getWrapped(str, isFinal) {
|
|
119
117
|
str = wrap(str, this.options.lineLength);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
str = prefix + str;
|
|
118
|
+
if (!isFinal && str.length === this.options.lineLength) {
|
|
119
|
+
str += '\r\n';
|
|
123
120
|
}
|
|
124
|
-
|
|
125
121
|
return str;
|
|
126
122
|
}
|
|
127
123
|
|
|
@@ -179,7 +175,7 @@ class Encoder extends Transform {
|
|
|
179
175
|
}
|
|
180
176
|
|
|
181
177
|
if (this._curLine) {
|
|
182
|
-
this._curLine = this._getWrapped(this._curLine);
|
|
178
|
+
this._curLine = this._getWrapped(this._curLine, true);
|
|
183
179
|
this._writeChunk(Buffer.from(this._curLine, 'ascii'), true);
|
|
184
180
|
this._curLine = '';
|
|
185
181
|
}
|