Convert Jpg File to Base64 after HttpRequest


So I’m trying to get my imagefile of my serve to use it in my app.
the Imagefiles are stored as .jpg files but to use it i need them in a base64String

HTTP.get('ServerAdress', {}, {})
  .then( response => {  let str =; }

this is what i have so far i’ve tried to convert it with filereader:

let fileReader = new FileReader();

    fileReader.onload = function (event) {
      var srcData =; // <--- data: base64

      var newImage = document.createElement('img');
      newImage.src = srcData;

      document.getElementById("imgTest").innerHTML = newImage.outerHTML;
      alert("Converted Base64 version is "+document.getElementById("imgTest").innerHTML);
      alert("Converted Base64 version is "+document.getElementById("imgTest").innerHTML);


but the line doesn’t work
is there a better or nicer solution??