Convert byte Array To Base 64 - Node.js String

Node.js examples for String:Base 64

Description

Convert byte Array To Base 64

Demo Code

function byteArrayToBase64(byteArray){
    var binaryString = "";
    for (var i=0; i<byteArray.byteLength; i++){
        binaryString += String.fromCharCode(byteArray[i]);
    }/*w ww  .j  a v a 2  s .co  m*/
    var base64String = window.btoa(binaryString);
    return base64String;
}

Related Tutorials