Изменения от Главреда ГитЖС | Changes of GitJS Glavred

This commit is contained in:
Главред | Glavred
2020-08-31 15:02:00 +03:00
parent e65ed7b34c
commit 31bc65dfad
7 changed files with 35 additions and 11 deletions

View File

@@ -0,0 +1,15 @@
//https://developer.mozilla.org/ru/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
base64ЗашифроватьСтроку = строка =>
{
var байты = new TextEncoder("utf-8").encode(str);
return base64js.fromByteArray(байты);
};
base64EncodeString = base64ЗашифроватьСтроку;
base64РасшифроватьСтроку = строка =>
{
var байты = base64js.toByteArray(строка);
return new TextDecoder("utf-8").decode(байты);
};
base64DecodeString = base64РасшифроватьСтроку;