btoa.js/index.js

19 lines
279 B
JavaScript
Raw Normal View History

2011-09-09 20:56:22 +00:00
(function () {
"use strict";
function btoa(str) {
var buffer
;
if (str instanceof Buffer) {
buffer = str;
} else {
buffer = new Buffer(str.toString(), 'binary');
}
return buffer.toString('base64');
2011-09-09 20:56:22 +00:00
}
module.exports = btoa;
}());