Convert base64 api response to .apk file and download it

I am working with react and have a problem -> When a user clicks a button, the API is called which returns a base64. Is it possible to somehow convert that base64 to .apk file and then download it? My current onClick function looks like this:

const downloadApp = async() => {
    await userService.downloadMobileApp()
    .then(response=> {
      console.log("response: ",response);
      const linkSource = `data:application/apk;base64,${response.data}`;
      const downloadLink = document.createElement("a");
      const fileName = 'randomAppName.apk';
      downloadLink.href = linkSource;
      downloadLink.download = fileName;
      console.log("downloadLink: ",downloadLink)
      downloadLink.click();})
    .catch(error => {
      console.log("error: ",error)
    })
  }

I use this kind of code to convert and download .pdf files (using pdf instead of apk in ‘…:application/apk;base64…’, but with .apk it isn’t working. How can I achieve this? Thanks in advance!