对要上传到服务器的文件进行反病毒扫描 - Node.js

Anti virus scan for the files to be uploaded to the server - Node.js

我如何对作为请求负载出现的文件执行扫描,以确定它是否是潜在的病毒?对于前。如果有人将 EICAR 签名保存为 txt 文件并尝试上传,我想扫描并拒绝它,以防它是病毒文件。

我已经检查了 clamscan 但无法理解在此处的路径中指定的内容:-

  const ClamScan = new NodeClam().init({
clamscan: {
     path: '/usr/bin/clamscan', // Path to clamscan binary on your server
     db: null, // Path to a custom virus definition database
     scan_archives: true, // If true, scan archives (ex. zip, rar, tar, dmg, iso, etc...)
     active: true // If true, this module will consider using the clamscan binary
   }
 });

此外,我正在将文件上传到 amazon -s3 存储桶,该存储桶集成在 SAP CLOUD PLATFORM 的对象存储中。

可通过 NPM 获得的 clamscan 库是真正的 clamscan 程序的包装器,它是 ClamAV 的一部分。

您需要安装ClamAV。这将在名为 clamscan 的文件中包含一个程序。您将该程序的路径放在该字符串中。