@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 +14 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/LeUtils.js +16 -2
package/package.json
CHANGED
package/src/LeUtils.js
CHANGED
|
@@ -2982,7 +2982,14 @@ export const LeUtils = {
|
|
|
2982
2982
|
base64ToBytes:
|
|
2983
2983
|
(base64string) =>
|
|
2984
2984
|
{
|
|
2985
|
-
|
|
2985
|
+
const binary = LeUtils.atob(base64string.trim());
|
|
2986
|
+
const len = binary.length;
|
|
2987
|
+
let data = new Uint8Array(len);
|
|
2988
|
+
for(let i = 0; i < len; i++)
|
|
2989
|
+
{
|
|
2990
|
+
data[i] = binary.charCodeAt(i);
|
|
2991
|
+
}
|
|
2992
|
+
return data;
|
|
2986
2993
|
},
|
|
2987
2994
|
|
|
2988
2995
|
/**
|
|
@@ -2994,7 +3001,14 @@ export const LeUtils = {
|
|
|
2994
3001
|
bytesToBase64:
|
|
2995
3002
|
(arraybuffer) =>
|
|
2996
3003
|
{
|
|
2997
|
-
|
|
3004
|
+
const bytes = new Uint8Array(arraybuffer);
|
|
3005
|
+
const len = bytes.byteLength;
|
|
3006
|
+
let binary = '';
|
|
3007
|
+
for(let i = 0; i < len; i++)
|
|
3008
|
+
{
|
|
3009
|
+
binary += String.fromCharCode(bytes[i]);
|
|
3010
|
+
}
|
|
3011
|
+
return LeUtils.btoa(binary);
|
|
2998
3012
|
},
|
|
2999
3013
|
|
|
3000
3014
|
/**
|