@oneteam/clamav v1.0.1
@oneteam/clamav
This is a nodejs network only client for clamav daemon using the INSTREAM command.
We have been using clamscan with much success until file sizes started to get above 600MB at which point clamscan starts to timeout. This module goes back to basic and only supports network operation (clamd doesn't need to be installed locally, it needs to be available on the network though).
To scan a file:
const { scanFile } = require("@oneteam/clamav");
//clamd must be available at 127.0.0.1/3310
const result = await scanFile("myFilePath");
// result.path: "myFilePath"
// result.status: "FOUND"
// result.virus: "Virus Name"
//or
// result.status: "OK" => all good
//or
// result.status: "ERROR" => something went wrongTo scan a stream (eg before saving a file):
const { ClamdNetworkSocket } = require("@oneteam/clamav");
const address = "127.0.0.1"; // your clamd server address
const port = "3310"; // your clamd port number
const cd = new ClamdNetworkSocket(address, port);
const myStream = ...;
const result = await cd.instream("stream name", myStream);
// result.path: "stream name"
// result.status: "FOUND"
// result.virus: "Virus Name"
//or
// result.status: "OK" => all good
//or
// result.status: "ERROR" => something went wrongclamavCLI
node clamavCLI.jsprint the helpnode clamavCLI.js samplesrun the scan on samples in parallelnode clamavCLI.js eicarcreate and run the scan on eicar filenode clamavCLI.js path/to/my/filethis will scanpath/to/my/file
Developers
To get started, make sure docker is installed.
This is setup to work on unix like systems, but mostly to get started, once you have generated the samples file, no need for that anymore.
./makeSamples.shto generate the samplesnpm run clamavthis will start the docker daemon with clamav using the provided config on first run the virus database will get downloadednpm run clamdtoponce the docker daemon is started, this will provide a view on the clamav instance best viewed on80x24consolenpm testrun testsnpm run test:watchrun tests continuouslynpm run test:logrun tests with continuously debug logsnpm run test:samplesrun a scan on the samples in parallel