@lowentry/utils 1.25.2 → 1.25.3

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 CHANGED
@@ -3084,9 +3084,13 @@ var LeUtils = {
3084
3084
  * @returns {Uint8Array}
3085
3085
  */
3086
3086
  base64ToBytes: function base64ToBytes(base64string) {
3087
- return Uint8Array.from(LeUtils.atob(base64string.trim()), function (c) {
3088
- return c.charCodeAt(0);
3089
- });
3087
+ var binary = LeUtils.atob(base64string.trim());
3088
+ var len = binary.length;
3089
+ var data = new Uint8Array(len);
3090
+ for (var i = 0; i < len; i++) {
3091
+ data[i] = binary.charCodeAt(i);
3092
+ }
3093
+ return data;
3090
3094
  },
3091
3095
  /**
3092
3096
  * Converts bytes into a base64 string.
@@ -3095,7 +3099,13 @@ var LeUtils = {
3095
3099
  * @returns {string}
3096
3100
  */
3097
3101
  bytesToBase64: function bytesToBase64(arraybuffer) {
3098
- return LeUtils.btoa(String.fromCharCode.apply(String, _toConsumableArray(new Uint8Array(arraybuffer))));
3102
+ var bytes = new Uint8Array(arraybuffer);
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);
3099
3109
  },
3100
3110
  /**
3101
3111
  * Downloads the given base64 string as a file.