mirror of
https://github.com/bnmgh1/NodeSandbox.git
synced 2025-04-16 07:57:04 +08:00
18 lines
273 B
JavaScript
18 lines
273 B
JavaScript
(function () {
|
|
"use strict";
|
|
|
|
function btoa(str) {
|
|
var buffer;
|
|
|
|
if (str instanceof Buffer) {
|
|
buffer = str;
|
|
} else {
|
|
buffer = Buffer.from(str.toString(), 'binary');
|
|
}
|
|
|
|
return buffer.toString('base64');
|
|
}
|
|
|
|
module.exports = btoa;
|
|
}());
|