暂无个人介绍
https://yq.aliyun.com/articles/253170?spm=5176.100240.searchblog.9.8tMWIb 参考这篇文章
// Convert a base-64 string to a byte array
base64ToBytes (base64) {
// Use browser-native function if it exists
if (typeof atob === 'function') return this.stringToBytes(window.atob(base64))
// Remove non-base-64 characters
base64 = base64.replace(/[^A-Z0-9+/]/ig, '')
var bytes = []
for (var i = 0; i < base64.length; i++) {
switch (i % 4) {
case 1:
bytes.push((base64map.indexOf(base64.charAt(i - 1)) << 2) |
(base64map.indexOf(base64.charAt(i)) >>> 4))
break
case 2:
bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0xF) << 4) |
(base64map.indexOf(base64.charAt(i)) >>> 2))
break
case 3:
bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0x3) << 6) |
(base64map.indexOf(base64.charAt(i))))
break
}
}
return bytes
},
stringToBytes (str) {
var bytes = []
for (var i = 0; i < str.length; i++) {
bytes.push(str.charCodeAt(i))
}
return bytes
}
一定要转成base64ToBytes