Soenneker.Clamav.Util 4.0.48

Prefix Reserved
dotnet add package Soenneker.Clamav.Util --version 4.0.48
                    
NuGet\Install-Package Soenneker.Clamav.Util -Version 4.0.48
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Clamav.Util" Version="4.0.48" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Clamav.Util" Version="4.0.48" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Clamav.Util" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Clamav.Util --version 4.0.48
                    
#r "nuget: Soenneker.Clamav.Util, 4.0.48"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Clamav.Util@4.0.48
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Clamav.Util&version=4.0.48
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Clamav.Util&version=4.0.48
                    
Install as a Cake Tool

alternate text is missing from this package README image

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.48 0 9/15/2026
4.0.47 41 9/13/2026
4.0.46 43 9/13/2026
4.0.45 50 9/12/2026
4.0.44 51 9/12/2026
4.0.43 75 9/10/2026
4.0.42 74 9/10/2026
4.0.41 82 9/9/2026
4.0.40 78 9/9/2026
4.0.39 98 9/9/2026
4.0.38 88 9/8/2026
4.0.37 84 9/8/2026
4.0.36 85 9/8/2026
4.0.35 91 9/8/2026
4.0.34 92 9/8/2026
4.0.33 93 9/7/2026
4.0.32 90 9/7/2026
4.0.31 86 9/7/2026
4.0.30 84 9/7/2026
4.0.29 96 9/4/2026
Loading failed