Last active
December 19, 2022 18:29
-
-
Save samuelkarani/aadbc7d6d7bde3fc968038d93eb7fd01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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