1'use strict';
2
3import * as fs from 'fs';
4
5function linesNumber(fileName: string): number {
6 try {
7 let fileLines = fs.readFileSync(fileName, 'utf-8').split('\n');
8 return fileLines.length;
9 } catch (err) {
10 return 0;
11 }
12}
13console.log(linesNumber('my-file.txt'))