Skip to content

Instantly share code, notes, and snippets.

@samuelkarani
Last active December 19, 2022 18:29
Show Gist options
  • Save samuelkarani/aadbc7d6d7bde3fc968038d93eb7fd01 to your computer and use it in GitHub Desktop.
Save samuelkarani/aadbc7d6d7bde3fc968038d93eb7fd01 to your computer and use it in GitHub Desktop.
const fs = require('fs');
const NodeClam = require('clamscan');
// specify socket or TCP connection. read more at https://www.npmjs.com/package/clamscan#scanStream
const clamscan = new NodeClam().init({
clamdscan: {
socket: '/var/run/clamd.scan/clamd.sock',
host: '127.0.0.1',
port: 3310,
}
});
app.post('/upload', async (req, res) => {
const { isInfected, viruses } = await clamscan.scanStream(req);
if (!isInfected)
// upload to amazon S3
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment