UNPKG

b64-lite

Version:

isomorphic base64 library in 152 bytes

3 lines (2 loc) 760 B
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.b64Lite={})}(this,function(e){e.atob=function(e){return Buffer.from(e,"base64").toString("binary")},e.btoa=function(e){for(var t=0,r=e;t<r.length;t+=1)if(String.prototype.charCodeAt.call(r[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(e,"binary").toString("base64")},e.toBase64=function(e){return Buffer.from(e).toString("base64")},e.fromBase64=function(e){return Buffer.from(e,"base64").toString()},e.toBuffer=function(e){return new Uint8Array(Buffer.from(e,"base64"))}}); //# sourceMappingURL=b64-lite.umd.js.map