Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
Random access to a file in browser File API

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);

The data I need is at the end of the file, so aborting after a partial read is not a solution.

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!