clamscan icon indicating copy to clipboard operation
clamscan copied to clipboard

TypeError: clamscan.isInfected is not a function

Open Biraru opened this issue 1 year ago • 0 comments
trafficstars

did it like this

const clamscan = new NodeClam().init({
    removeInfected: true, // Removes files if they are infected
    quarantineInfected: './node-clam/infected/', // Move files here if they are infected
    scanLog: './node-clam/log/', // You're a detail-oriented virus logger
    debugMode: true, // Whether to log info/debug statements
    clamscan: {
        path: 'S:/ClamAV/clamscan.exe', // <-- change this to the correct path
        db: 'S:/ClamAV/database',
        scanArchives: true,
        active: true
    },
    clamdscan: {
        path: 'S:/ClamAV/clamd.exe', // <-- provide the correct path here
        config_file: 'S:/ClamAV/clamd.conf',
        multiscan: true,
        reloadDb: true,
        active: true,
        bypass_test: false,
    },
    preference: "clamdscan"
});`
try {
        clamscan.isInfected(icon).then((err, file, isInfected, viruses) => {
            if (err) {
                console.log(err);
            }
            else if (isInfected) {
                return res.status(400).json({
                    message: `Uploaded file is infected. Viruses: ${viruses}`,
                    error: 'INFECTED-FILE',
                    csrfToken: req.csrfToken()
                });
            }
        });

    } catch (err) {
        console.log(`Error while scanning file ${icon.path}`, err);
    }

Biraru avatar Dec 22 '23 18:12 Biraru