mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
packages
This commit is contained in:
14
packages/cli/src/utils/encode/index.ts
Normal file
14
packages/cli/src/utils/encode/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export const stringToBase64 = (str: string) => {
|
||||
if (typeof btoa !== "undefined") {
|
||||
return btoa(str);
|
||||
}
|
||||
|
||||
return Buffer.from(str).toString("base64");
|
||||
};
|
||||
|
||||
export const base64ToString = (base64: string) => {
|
||||
if (typeof atob !== "undefined") {
|
||||
return atob(base64);
|
||||
}
|
||||
return Buffer.from(base64, "base64").toString();
|
||||
};
|
||||
Reference in New Issue
Block a user