Convert base 64 To Byte Array - Node.js String

Node.js examples for String:Base 64

Description

Convert base 64 To Byte Array

Demo Code

function base64ToByteArray(base64String){
    var binaryString = window.atob(base64String);
    var byteArray = new Uint8Array(binaryString.length);
    for (var i=0; i<binaryString.length; i++){
        byteArray[i] += binaryString.charCodeAt(i);
    }/*from w  ww .  j a v a 2  s  .c  o  m*/
    return byteArray;
}

Related Tutorials