I'm developing this code that, after the user selects a directory, it display a table of the files contained in that location with their details (name, type, size ...).
A directory may contain a lot of files.
I succeeded to achieve that. But, my problem is that I want to display the number of lines in each file. I can get the number of lines using this JavaScript code :
var reader = new FileReader();
var textFile = $("#file").get(0).files[0];
reader.readAsText(textFile);
$(reader).on('load', processFile);
/*And in processFile() i use this line to get the number of lines :*/
nbLines = (file.split("\n")).length;
The above code work as expected and it give me what I want, but it may a heavy process if there is so many files in the selected directory!
The Question : Is there a way to get the number of lines in a text file without reading it?
Regards!