clamscan
clamscan copied to clipboard
Added clam scan cli function
Noticed there was no ability to directly call the 'clamscan' CLI command directly. I think this will help users who have a subset of files they want to have special configurations for, but don't need another daemon spun up. I have also added a lot of missing arguments for clamscan.
Would like your feedback before I update the README.
I'll run prettier to fix the formatting on this in a bit as well
So, I think you can already do it with the currently library--you would just need 2 instances of the library which really isn't too big of a deal. This library already does not spin up a clamscan daemon as is (it should be already running on your server or other server).
So, for example...
import NodeClam from 'clamscan';
const cliScanner = new NodeClam().init({
clamscan: { path: '/usr/bin/clamscan', active: true },
clamdscan: { localFallback: true, active: false },
preference: 'clamscan',
});
const daemonScanner = new NodeClam().init({
clamscan: { active: true }, // or false if you dont want it to fallback
clamdscan: {
socket: false,
host: '127.0.0.1',
port: 3310,
timeout: 1000,
localFallback: true, // false, if you don't want it to try and fallback to the cli option
path: '/usr/bin/clamdscan',
active: true,
},
preference: 'clamdscan',
});
Lemme know if that works for you!
Thanks for letting me know. I removed that function and added an example using the method you described in case anyone wants a reference for how to do that. If you want me to remove that example file let me know.
Let me know what you think about the updated CLI flags I pushed to the _buildClamFlags function
Also let me know if you need me to write unit tests