@lowentry/utils 1.25.1 → 1.25.2
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/index.js +4 -14
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/LeUtils.js +2 -16
package/index.js
CHANGED
|
@@ -3084,13 +3084,9 @@ var LeUtils = {
|
|
|
3084
3084
|
* @returns {Uint8Array}
|
|
3085
3085
|
*/
|
|
3086
3086
|
base64ToBytes: function base64ToBytes(base64string) {
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
for (var i = 0; i < len; i++) {
|
|
3091
|
-
data[i] = binary.charCodeAt(i);
|
|
3092
|
-
}
|
|
3093
|
-
return data;
|
|
3087
|
+
return Uint8Array.from(LeUtils.atob(base64string.trim()), function (c) {
|
|
3088
|
+
return c.charCodeAt(0);
|
|
3089
|
+
});
|
|
3094
3090
|
},
|
|
3095
3091
|
/**
|
|
3096
3092
|
* Converts bytes into a base64 string.
|
|
@@ -3099,13 +3095,7 @@ var LeUtils = {
|
|
|
3099
3095
|
* @returns {string}
|
|
3100
3096
|
*/
|
|
3101
3097
|
bytesToBase64: function bytesToBase64(arraybuffer) {
|
|
3102
|
-
|
|
3103
|
-
var len = bytes.byteLength;
|
|
3104
|
-
var binary = '';
|
|
3105
|
-
for (var i = 0; i < len; i++) {
|
|
3106
|
-
binary += String.fromCharCode(bytes[i]);
|
|
3107
|
-
}
|
|
3108
|
-
return LeUtils.btoa(binary);
|
|
3098
|
+
return LeUtils.btoa(String.fromCharCode.apply(String, _toConsumableArray(new Uint8Array(arraybuffer))));
|
|
3109
3099
|
},
|
|
3110
3100
|
/**
|
|
3111
3101
|
* Downloads the given base64 string as a file.
|