0

i have a code to read a text file in javascript

<input type="file" id="input" onchange="readFile()">

<script>
function readFile(){
     var fr = new FileReader();
     fr.onload = function() {
       var textContent = fr.result;
       //The code
     }
  
  fr.readAsText(document.getElementById("input").files[0]);
}
</script>

but the file that i want to read is too big so i want to read a specific line of it in javascript

Important

I want it in javascript not node.js

The files is local not online

  • You cannot change that on the client. You can use a proxy on the server to scan and extract the parts you want. If the file is on your harddisk, you will need to read the complete file to get at the line – mplungjan Feb 10 '21 at 07:34
  • 1
    My comment combined with the correct dupes is answering you question – mplungjan Feb 10 '21 at 07:54

0 Answers0