How can I convert an URL image into Base64 string using JavaScript?

I am just starting to learn JavaScript and working on a HTML webform that will be use a signature device, I need to capture user signature, basically user will sign and after hit save, I want their signature to be display on the HTML webpage. I am trying to display the signature but image is broken, I need help and I do not know why my image is breaking…

            <script>

              async function addImage() {
                const imageUrl = 'http://localhost:12001/SigCaptureWait?ResponseType=API&UseReceiptDataList=1&ReturnSigType=PNG&CreateFile=false&TopazType=1';
                const response = await fetch(imageUrl);
                const imageBlob = await response.blob();
                const objectURL = URL.createObjectURL(imageBlob);
                const imageElement = new Image();
                imageElement.src = objectURL;

                console.log({objectURL})

                document.getElementById('imageContainer').appendChild(imageElement);
            }
            addImage();     

            </script>