| 6 | import readline from 'readline' |
| 7 | |
| 8 | const readFile = (filePath: string) => { |
| 9 | return new Promise(function (resolve, reject) { |
| 10 | const lines: string[] = [] |
| 11 | var rl = readline.createInterface({ |
| 12 | input: fs.createReadStream(filePath) |
| 13 | }) |
| 14 | |
| 15 | rl.on('line', (line) => { |
| 16 | lines.push(line) |
| 17 | }) |
| 18 | |
| 19 | rl.on('close', () => { |
| 20 | // Add newlines to lines |
| 21 | resolve(lines.join('\n')) |
| 22 | }) |
| 23 | |
| 24 | rl.on('error', (error) => { |
| 25 | reject(`Error reading file ${filePath}: ${error}`) |
| 26 | }) |
| 27 | }) |
| 28 | } |
| 29 | |
| 30 | const generateDateRange = (startDate: string, endDate: string) => { |
| 31 | const start = startDate.split('-') |