import fs from "fs"; import readline from "readline"; const user = process.argv[2]; // Estensioni foto/video const photoExt = [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp", ".tiff", ".heic", ".heif"]; const videoExt = [".mp4", ".mov", ".avi", ".mkv", ".webm", ".m4v"]; // Funzione per capire se รจ foto o video function isMediaFile(filename) { const lower = filename.toLowerCase(); return photoExt.some(ext => lower.endsWith(ext)) || videoExt.some(ext => lower.endsWith(ext)); } console.log(`Node attivo per utente: ${user}`); const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity }); rl.on("line", line => { // line contiene: "path ACTION file" const parts = line.trim().split(" "); const file = parts[parts.length - 1]; const path = parts[0]; if (isMediaFile(file)) { console.log(`Scan di ${user}: ${path}${file}`); } else { console.log(`Ignorato (non media): ${file}`); } });