Soenneker.Utils.File.Types
4.0.1670
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Utils.File.Types --version 4.0.1670
NuGet\Install-Package Soenneker.Utils.File.Types -Version 4.0.1670
<PackageReference Include="Soenneker.Utils.File.Types" Version="4.0.1670" />
<PackageVersion Include="Soenneker.Utils.File.Types" Version="4.0.1670" />
<PackageReference Include="Soenneker.Utils.File.Types" />
paket add Soenneker.Utils.File.Types --version 4.0.1670
#r "nuget: Soenneker.Utils.File.Types, 4.0.1670"
#:package Soenneker.Utils.File.Types@4.0.1670
#addin nuget:?package=Soenneker.Utils.File.Types&version=4.0.1670
#tool nuget:?package=Soenneker.Utils.File.Types&version=4.0.1670
Soenneker.Utils.File.Types
Case-insensitive extension classification for common video, audio, subtitle, and artwork files, plus recursive video discovery.
Installation
dotnet add package Soenneker.Utils.File.Types
Registration
builder.Services.AddFileTypeUtilAsSingleton();
Scoped registration is also available with AddFileTypeUtilAsScoped().
Classify extensions and paths
bool videoExtension = fileTypes.IsVideoExtension(".mkv");
bool audioExtension = fileTypes.IsAudioExtension(".flac");
bool subtitleExtension = fileTypes.IsSubtitleExtension(".vtt");
bool artworkExtension = fileTypes.IsImageExtension(".jpg");
bool videoFile = fileTypes.IsVideoFile(@"C:\media\movie.MP4");
bool imageFile = fileTypes.IsImageFile("poster.png");
Extension methods expect the leading period; pass .mp4, not mp4. File methods extract the extension from the supplied path or name. Matching is ordinal and case-insensitive.
Classification is based only on the name. It does not inspect file signatures, MIME types, codecs, or file contents and must not be used as a security validation boundary for uploads.
Discover video files
List<FileInfo> videos = await fileTypes.GetAllVideoFiles(mediaDirectory);
await foreach (FileInfo video in fileTypes.EnumerateVideoFiles(mediaDirectory))
{
Console.WriteLine(video.FullName);
}
Both APIs first materialize a recursive file snapshot, skipping inaccessible directories and reparse points, and then filter it by extension. EnumerateVideoFiles() exposes async iteration but does not provide true filesystem streaming or cancellation.
Container codecs
if (fileTypes.TryGetContainerMediaSet(".mkv", out MediaFormatSet? formats) == true)
{
IReadOnlyList<string> videoCodecs = formats.VideoCodecs;
IReadOnlyList<string> audioCodecs = formats.AudioCodecs;
}
Container lookup requires the leading period and only contains explicitly defined mappings. The returned codec lists are defensive copies and can be modified without changing later lookups. They describe the library's known mapping, not the codecs actually present in a particular file.
| 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
- Soenneker.Utils.File (>= 4.0.2247)
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.1676 | 39 | 9/5/2026 |
| 4.0.1675 | 39 | 9/4/2026 |
| 4.0.1674 | 36 | 9/4/2026 |
| 4.0.1673 | 39 | 9/4/2026 |
| 4.0.1672 | 41 | 9/4/2026 |
| 4.0.1671 | 37 | 9/4/2026 |
| 4.0.1670 | 44 | 9/4/2026 |
| 4.0.1669 | 82 | 9/1/2026 |
| 4.0.1668 | 71 | 8/31/2026 |
| 4.0.1667 | 76 | 8/31/2026 |
| 4.0.1666 | 85 | 8/31/2026 |
| 4.0.1665 | 85 | 8/31/2026 |
| 4.0.1664 | 78 | 8/30/2026 |
| 4.0.1663 | 75 | 8/30/2026 |
| 4.0.1662 | 83 | 8/30/2026 |
| 4.0.1661 | 112 | 8/30/2026 |
| 4.0.1660 | 83 | 8/30/2026 |
| 4.0.1659 | 76 | 8/29/2026 |
| 4.0.1658 | 81 | 8/29/2026 |
| 4.0.1657 | 81 | 8/29/2026 |
Update dependency Soenneker.Utils.File to 4.0.2247 (#2221)