Virus Scan on Edge Functions
I have an edge function that receives a multi form data that can contains files. I read that Supabase Storage does not an analysis on file content so I'll need to do a virus check manually.
I wanted to use Clamscan but I dont know how to integrate that with supabase, any suggestions?
2 Replies
You can't install ClamAV on edge functions unfortunately, if you're not running it self-hosted it can be difficult. The steps would be to
- Have any linux server(Debian?) with Clamshell installed
- Create a webserver with an API that accepts the files you want to scan
- Once the files are scanned on this webserver, have the webserver upload it to Supabase bucket
After typing the above message I just found a node package for ClamAV: https://www.npmjs.com/package/clamav.js
However reading the docs I'm not sure how you're gonna access the directory to the file.
npm
clamav.js
A node.js library for ClamAV.. Latest version: 0.12.0, last published: 10 years ago. Start using clamav.js in your project by running
npm i clamav.js
. There are 3 other projects in the npm registry using clamav.js.