我正在尝试在 NodeJS 中的 Windows 10 pro 机器上使用 clamscan。Clamscan 安装到
C:\Program Files\ClamAV
我有这个代码..
const NodeClam = require('clamscan');
const ClamScan = new NodeClam().init({
scan_recursively: false,
clamdscan: {
path: 'C:\Program Files\ClamAV\clamscan.exe',
local_fallback: true,
config_file: 'C:\Program Files\ClamAV\clamd.conf'
},
});
async function scanFile(filePath) {
try {
const clamscan = await ClamScan;
const { is_infected, viruses } = await clamscan.scan_file(filePath);
if (is_infected) {
console.log(`The file is INFECTED with ${viruses}`);
throw new Error('ERR_FILE_SCAN_INFECTED');
} else {
return 'CLEAN';
}
} catch (err) {
throw new Error(err);
}
}
function start() {
return scanFile('/dodgyfile.rtf');
}
// Call start
(async() => {
try{
await start();
}
catch(err){
console.log("error: ",err);
}
})();
我收到错误消息。没有有效和活动的病毒扫描二进制文件处于活动状态且可用,并且没有提供主机/套接字选项!
网上所有的配置示例似乎都是针对 linux 路径的..
有没有人有在 Windows 上使用它的经验?谢谢