I have made a small binary (DAT) file using C#, which just contains a random name and a number. Now I am trying to figure out how I can read this file in HTML.
I heard JavaScript was the way to go, so I tried this method:
const input =
document.querySelector('input[type="file"]')
input.addEventListener('change', function (e) {
console.log(input.files)
const reader = new FileReader()
reader.onload = function () {
console.log(reader.result)
}
reader.readAsText(input.files[0])
}, false)
The problem is that the content of the DAT file still looks like gibberish when I view it in the console log.
I would like to be able to read the data and display it on an HTML page.
Is this possible with JavaScript alone, or is there a different method that I have overlooked?