refactor: centralize base64 encoding
This commit is contained in:
7
utils/base64.ts
Normal file
7
utils/base64.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const encodeBase64 = (value: string): string => {
|
||||
if (typeof btoa !== 'undefined') {
|
||||
return btoa(value);
|
||||
}
|
||||
|
||||
return Buffer.from(value, 'utf-8').toString('base64');
|
||||
};
|
||||
Reference in New Issue
Block a user