Counts the number of lines in a file.


411.1.05 years ago5 years agoMinified + gzip package size for @jasonmit/count-lines-in-file in KB



NPM version Travis build status js-canonical-style

Counts the number of lines in a file using fs.createReadStream and split.

const countLinesInFile = require('count-lines-in-file');
const path = require('path');
const targetFilePath = path.resolve(__dirname, './data.txt');

countLinesInFile(targetFilePath, (error: Error, numberOfLines: number) => {


If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.