blob: 9dc95f59a161439cf5cd18ed1a9d1ff10827bb86 [file] [log] [blame]
import buffer from './buffer';
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
};