📜  base64 到 arraybuffer - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:41.438000             🧑  作者: Mango

代码示例3
function base64ToArrayBuffer(base64) {
    let binaryString = window.atob(base64);
    let binaryLength = binaryString.length;
    let bytes = new Uint8Array(binaryLength);

    for (let i = 0; i < binaryLength; i++) {
        let ascii = binaryString.charCodeAt(i);
        bytes[i] = ascii;
    }
    return bytes;
}