mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
20 lines
365 B
JavaScript
20 lines
365 B
JavaScript
'use strict';
|
|
|
|
module.exports.btoa = (str) => {
|
|
if (typeof btoa === 'function')
|
|
return btoa(str);
|
|
|
|
return Buffer
|
|
.from(str)
|
|
.toString('base64');
|
|
};
|
|
|
|
module.exports.atob = (str) => {
|
|
if (typeof atob === 'function')
|
|
return atob(str);
|
|
|
|
return Buffer
|
|
.from(str, 'base64')
|
|
.toString('binary');
|
|
};
|
|
|