atob 或者btoa 方法是浏览器实现的而非 js 自带,需要需要使用这两个方法需要自己实现 最前面加上这段js 就可以使用了
global.Buffer = global.Buffer || require('buffer').Buffer; if (typeof btoa === 'undefined') { global.btoa = function (str) { return new Buffer.from(str).toString('base64'); }; } if (typeof atob === 'undefined') { global.atob = function (b64Encoded) { return new Buffer.from(b64Encoded, 'base64').toString(); }; }
标签:b64Encoded,defined,global,btoa,Buffer,atob From: https://www.cnblogs.com/yoyo1216/p/17671673.html