UNPKG

b64-lite

Version:

isomorphic base64 library in 152 bytes

3 lines (2 loc) 611 B
exports.atob=function(r){return Buffer.from(r,"base64").toString("binary")},exports.btoa=function(r){for(var t=0,e=r;t<e.length;t+=1)if(String.prototype.charCodeAt.call(e[t],0)>255)throw new Error("Failed to execute 'btoa': The string to be encoded contains characters outside of the Latin1 range.");return Buffer.from(r,"binary").toString("base64")},exports.toBase64=function(r){return Buffer.from(r).toString("base64")},exports.fromBase64=function(r){return Buffer.from(r,"base64").toString()},exports.toBuffer=function(r){return new Uint8Array(Buffer.from(r,"base64"))}; //# sourceMappingURL=b64-lite.js.map