import * as fs from 'fs'; import * as readline from 'readline'; async function checkDuplicates(filePath: string) { const fileStream = fs.createReadStream(filePath); const rl = readline.createInterface({ input: fileStream, crlfDelay: Infinity }); const lines = new Set(); for await (const line of rl) { if (lines.has(line)) { console.log(`Duplicate line found: ${line}`); return; } lines.add(line); } console.log('No duplicate lines found.'); } const filePath = process.argv[2]; if (!filePath) { console.log('Please provide a file path as the first argument.'); process.exit(1); } checkDuplicates(filePath);