lib/utils/byte-utils.js
function bytesToBase64(arr) {
    if (arr instanceof ArrayBuffer) {
        arr = new Uint8Array(arr);
    }
    if (typeof btoa === 'undefined' && typeof Buffer === 'function') {
        // node.js doesn't have btoa
        var buffer = Buffer.from(arr);
        return buffer.toString('base64');
    }
    var str = '';
    for (var i = 0; i < arr.length; i++) {
        str += String.fromCharCode(arr[i]);
    }
    return btoa(str);
}
function bytesToBase64(arr) {
    if (arr instanceof ArrayBuffer) {
        arr = new Uint8Array(arr);
    }
    if (typeof btoa === 'undefined' && typeof Buffer === 'function') {
        // node.js doesn't have btoa
        var buffer = Buffer.from(arr);
        return buffer.toString('base64');
    }
    var str = '';
    for (var i = 0; i < arr.length; i++) {
        str += String.fromCharCode(arr[i]);
    }
    return btoa(str);
}
function bytesToBase64 ( arr ) { if ( arr instanceof ArrayBuffer ) { arr = new Uint8Array ( arr ) ; } if ( typeof btoa === 'undefined' && typeof Buffer === 'function' ) { // node.js doesn't have btoa var buffer = Buffer . from ( arr ) ; return buffer . toString ( 'base64' ) ; } var str = '' ; for ( var i = 0 ; i < arr . length ; i ++ ) { str += String . fromCharCode ( arr [ i ] ) ; } return btoa ( str ) ; }
Converts Array or ArrayBuffer to base64-string
@param {Array|Uint8Array|ArrayBuffer} arr
@return {string}
Converts Array or ArrayBuffer to base64 - string