Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added clam scan cli function #138

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

psilves1
Copy link
Contributor

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.

@psilves1
Copy link
Contributor Author

I'll run prettier to fix the formatting on this in a bit as well

@kylefarris
Copy link
Owner

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!

@psilves1
Copy link
Contributor Author

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

@psilves1
Copy link
Contributor Author

Also let me know if you need me to write unit tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants