I can use the File API to read the whole file with reader.readAsArrayBuffer(file);
const inputElement = document.getElementById("input");
inputElement.addEventListener("change", handleFiles, false);
function handleFiles() {
const fileList = this.files;
if (fileList.length != 1) return
const file = fileList[0];
const reader = new FileReader();
reader.onload = function(e) {
console.log("e.target.result", e.target.result);
...
}
reader.readAsArrayBuffer(file);
How do I perform a random read on a file in the browser? e.g. reader.readAsArrayBuffer(file, offset, length);
I only want to read a small part of a multi-GB file – reading it all to RAM is not an option. How can I do this?