2011-09-09 20:56:22 +00:00
|
|
|
(function () {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
function btoa(str) {
|
2016-05-10 16:01:01 +00:00
|
|
|
var buffer;
|
2013-07-25 16:14:17 +00:00
|
|
|
|
|
|
|
if (str instanceof Buffer) {
|
|
|
|
buffer = str;
|
|
|
|
} else {
|
2021-09-01 14:38:47 +00:00
|
|
|
buffer = Buffer.from(String(str), 'binary');
|
2013-07-25 16:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return buffer.toString('base64');
|
2011-09-09 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = btoa;
|
|
|
|
}());
|