nwc-l
Lighweight Node.js module for counting the number of lines in a file either sync or
async. This module doesn't have any external dependencies, it uses only the
native fs
module.
Install with
npm install nwc-l
Documentation
wcl.sync(fileLocation);
fileLocation
- String path to the file you want to read from- Returns:
<integer>
number of lines
wcl.async(fileLocation);
fileLocation
- String path to the file you want to read from- Returns:
<Promise>
number of lines
Example
const nwcl = ; // Synchronouslet count = nwcl;console; // Asyncronious Promisenwcl;// Asyncronious await { let asyncCount = await nwcl; console;};
will print
Number of lines: 7
Number of lines: 7
Number of lines: 7