blob: 2dee6c9f71d86e73c683f4ff87fe46d71adefff9 [file] [log] [blame]
function thisAtob(str) {
var base64 = new Buffer(str, 'base64');
// Node.js will just skip the characters it can't decode instead of
// throwing an exception
if (base64.toString('base64') !== str) {
throw new Error("attachment is not a valid base64 string");
}
return base64.toString('binary');
}
function thisBtoa(str) {
return new Buffer(str, 'binary').toString('base64');
}
export {
thisAtob as atob,
thisBtoa as btoa
};