Currently I can read the result of onChange of a fileInput element, as a base64 string.

I want to implement a link on the page so that DIFFERENT users can download the same file as the resultant base64 or blob.

As a complement, the file type is unknown. Because I want any file type supported. Or some popular file types among images, MS office and text files.

Let me put my current code bellow.

[I borrowed some code from here.](https://stackoverflow.com/questions/33855167/convert-data-file-to-blob/33855825)

```
//index.js

const fileInput="fileInput";
init();
function init(){
   document.getElementById(fileInput).addEventListener('change', readFile);
   document.getElementById(fileInput).addEventListener('click',  (e) => {
      e.target.value = '';
   });
}

function readFile(){
var file = document.getElementById(fileInput).files[0];
readFile2(file);

function readFile2(file) {
var reader = new FileReader();
reader.readAsDataURL(file);

reader.onload =async function () {
   const myBlob=await (reader.result); //I assume this is a blob.
   const fileToStr=myBlob.toString();
   alert(fileToStr); //base64

   const blobUrl = URL.createObjectURL(myBlob);//ERROR
/*
index.js:22 Uncaught (in promise) TypeError: Failed to execute 'createObjectURL' on 'URL': Overload resolution failed.
    at FileReader.reader.onload (index.js:22)
*/

   var link = document.createElement("a"); // Or maybe get it from the current document
link.href = blobUrl;
link.download = "aDefaultFileName.txt";// I want any file type supported.
link.innerHTML = "Click here to download the file";
document.body.appendChild(link); // Or append it whereever you want
//console.log(fileToStr);
}}}

```