Soenneker.Clamav.Util
4.0.47
Prefix Reserved
dotnet add package Soenneker.Clamav.Util --version 4.0.47
NuGet\Install-Package Soenneker.Clamav.Util -Version 4.0.47
<PackageReference Include="Soenneker.Clamav.Util" Version="4.0.47" />
<PackageVersion Include="Soenneker.Clamav.Util" Version="4.0.47" />
<PackageReference Include="Soenneker.Clamav.Util" />
paket add Soenneker.Clamav.Util --version 4.0.47
#r "nuget: Soenneker.Clamav.Util, 4.0.47"
#:package Soenneker.Clamav.Util@4.0.47
#addin nuget:?package=Soenneker.Clamav.Util&version=4.0.47
#tool nuget:?package=Soenneker.Clamav.Util&version=4.0.47
Soenneker.Clamav.Util
A cross-platform .NET API for scanning files and directories with bundled official ClamAV command-line distributions.
Install
dotnet add package Soenneker.Clamav.Util
Soenneker.Clamav.Util depends on Soenneker.Clamav.Definitions. NuGet restore copies its recent database seed into Resources/clamav-database; FreshClam updates that same directory in place, allowing it to download incremental updates instead of every complete database.
Quick start
using Microsoft.Extensions.DependencyInjection;
using Soenneker.Clamav.Util.Abstract;
using Soenneker.Clamav.Util.Registrars;
await using ServiceProvider provider = new ServiceCollection()
.AddLogging()
.AddClamavUtilAsSingleton()
.BuildServiceProvider();
IClamavUtil clamav = provider.GetRequiredService<IClamavUtil>();
var fileResult = await clamav.ScanFile("uploads/document.pdf");
if (fileResult.IsInfected)
{
foreach (var detection in fileResult.Detections)
Console.WriteLine($"{detection.Path}: {detection.Signature}");
}
var directoryResult = await clamav.ScanDirectory("uploads");
Virus definitions are updated with freshclam once before the first scan and stored in Resources/clamav-database beneath the application output directory. Concurrent first scans share that initialization operation. Use a custom writable location when appropriate:
using Soenneker.Clamav.Util.Options;
var result = await clamav.Scan("uploads", new ClamavScanOptions
{
DatabaseDirectory = "/var/lib/my-app/clamav",
UpdateDefinitions = true,
DetectPotentiallyUnwantedApplications = true,
AllMatches = true,
Timeout = TimeSpan.FromMinutes(10)
});
By default, FreshClam checks for incremental updates to the packaged seed before the first scan for each database directory. Set UpdateDefinitions to false to skip initialization; the scan will then require an existing database. Call UpdateDefinitions explicitly when the definitions need to be refreshed later.
ClamavUtil does not schedule or serialize scan requests. Applications that require bounded or sequential processing should coordinate calls before invoking the utility.
Services that scan repeatedly can keep the signature database loaded in a managed clamd process:
services.AddClamavUtilAsSingleton(options =>
{
options.UseDaemon = true;
});
Daemon mode starts lazily on the first scan and is stopped when the utility is disposed. Scan options that cannot be changed per request by clamd automatically fall back to clamscan.
Definitions can also be managed explicitly:
await clamav.UpdateDefinitions("data/clamav");
var result = await clamav.ScanFile("sample.zip", new ClamavScanOptions
{
DatabaseDirectory = "data/clamav",
UpdateDefinitions = false
});
Definition updates are delegated to Soenneker.Clamav.Freshclam.Util, which selects the separately packaged Linux or Windows FreshClam runtime.
Supported environments
| Operating system | Architecture | Bundled tool |
|---|---|---|
| Windows | x64 | clamscan.exe, clamd.exe, clamdscan.exe |
| Linux | x64 | clamscan, clamd, clamdscan |
Other operating systems and architectures throw PlatformNotSupportedException.
Licensing
Soenneker.Clamav.Util is MIT-licensed. Its native package dependencies redistribute official ClamAV binaries under GPL-2.0-only; those terms apply to the bundled native payload. Each native package includes the GPL text, upstream third-party notices, and an exact corresponding-source reference in its runtime SOURCE.txt.
See the official Cisco-Talos/clamav releases for upstream release and source materials.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Options (>= 10.0.12)
- Soenneker.Asyncs.Initializers (>= 4.0.99)
- Soenneker.Clamav.Definitions (>= 4.0.27)
- Soenneker.Clamav.Freshclam.Util (>= 4.0.35)
- Soenneker.Clamav.Linux (>= 4.0.4)
- Soenneker.Clamav.Windows (>= 4.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.47 | 31 | 9/13/2026 |
| 4.0.46 | 34 | 9/13/2026 |
| 4.0.45 | 41 | 9/12/2026 |
| 4.0.44 | 42 | 9/12/2026 |
| 4.0.43 | 67 | 9/10/2026 |
| 4.0.42 | 66 | 9/10/2026 |
| 4.0.41 | 75 | 9/9/2026 |
| 4.0.40 | 70 | 9/9/2026 |
| 4.0.39 | 88 | 9/9/2026 |
| 4.0.38 | 78 | 9/8/2026 |
| 4.0.37 | 74 | 9/8/2026 |
| 4.0.36 | 75 | 9/8/2026 |
| 4.0.35 | 83 | 9/8/2026 |
| 4.0.34 | 84 | 9/8/2026 |
| 4.0.33 | 92 | 9/7/2026 |
| 4.0.32 | 89 | 9/7/2026 |
| 4.0.31 | 85 | 9/7/2026 |
| 4.0.30 | 83 | 9/7/2026 |
| 4.0.29 | 95 | 9/4/2026 |
| 4.0.28 | 97 | 9/4/2026 |