Fix file handle leak on empty chat info
| @@ -368,7 +368,6 @@ async function checkChatIntegrity(filePath, integritySlug) { | ||
| 368 | 368 | */ |
| 369 | 369 | export async function getChatInfo(pathToFile, additionalData = {}, isGroup = false) { |
| 370 | 370 | return new Promise(async (res) => { |
| 371 | - const fileStream = fs.createReadStream(pathToFile); | |
| 372 | 371 | const stats = await fs.promises.stat(pathToFile); |
| 373 | 372 | const fileSizeInKB = `${(stats.size / 1024).toFixed(2)}kb`; |
| 374 | 373 | |
| @@ -392,6 +391,7 @@ export async function getChatInfo(pathToFile, additionalData = {}, isGroup = fal | ||
| 392 | 391 | return; |
| 393 | 392 | } |
| 394 | 393 | |
| 394 | + const fileStream = fs.createReadStream(pathToFile); | |
| 395 | 395 | const rl = readline.createInterface({ |
| 396 | 396 | input: fileStream, |
| 397 | 397 | crlfDelay: Infinity, |