UNPKG

@internxt/scan

Version:

Use Node JS to scan files on your server with ClamAV's clamscan/clamdscan binary or via TCP to a remote server or local UNIX Domain socket. This is especially useful for scanning uploaded files provided by un-trusted sources.

29 lines (26 loc) 1.22 kB
// Initialize the clamscan module const NodeClam = require('../index'); // Offically: require('clamscan'); const ClamScan = new NodeClam().init({ debugMode: false, // prettier-ignore clamdscan: { // Run scan using command line path: '/usr/bin/clamdscan', // <-- Secondary fallback to command line -| configFile: '/etc/clamd.d/daemon.conf', // <---------------------------------------| // Connect via Host/Port host: 'localhost', // <-- Primary fallback - | port: 3310, // <----------------------| // Connect via socket (preferred) socket: '/var/run/clamd.scan/clamd.sock', // <-- Preferred connection method active: true, // Set to 'false' to test getting version info from `clamscan` }, // prettier-ignore clamscan: { path: '/usr/bin/clamscan', // <-- Worst-case scenario fallback }, preference: 'clamdscan', // Set to 'clamscan' to test getting version info from `clamav` }); ClamScan.then(async (av) => { const result = await av.getVersion(); console.log('Version: ', result); });