8 lines
183 B
TypeScript
8 lines
183 B
TypeScript
export const encodeBase64 = (value: string): string => {
|
|
if (typeof btoa !== 'undefined') {
|
|
return btoa(value);
|
|
}
|
|
|
|
return Buffer.from(value, 'utf-8').toString('base64');
|
|
};
|