I have large text files, which range between 30MB and 10GB. How can I count the number of lines in a file using Node.js?
30MB
10GB
Node.js
I hav
Here is another way without so much nesting.
var fs = require('fs'); filePath = process.argv[2]; fileBuffer = fs.readFileSync(filePath); to_string = fileBuffer.toString(); split_lines = to_string.split("\n"); console.log(split_lines.length-1);