Files
cosmos-explorer/src/Utils/Base64Utils.ts
2021-01-20 09:15:01 -06:00

8 lines
214 B
TypeScript

export const utf8ToB64 = (utf8Str: string): string => {
return btoa(
encodeURIComponent(utf8Str).replace(/%([0-9A-F]{2})/g, (_, args) => {
return String.fromCharCode(parseInt(args, 16));
})
);
};