FormatDetector 1.7.0
dotnet add package FormatDetector --version 1.7.0
NuGet\Install-Package FormatDetector -Version 1.7.0
<PackageReference Include="FormatDetector" Version="1.7.0" />
<PackageVersion Include="FormatDetector" Version="1.7.0" />
<PackageReference Include="FormatDetector" />
paket add FormatDetector --version 1.7.0
#r "nuget: FormatDetector, 1.7.0"
#:package FormatDetector@1.7.0
#addin nuget:?package=FormatDetector&version=1.7.0
#tool nuget:?package=FormatDetector&version=1.7.0
FormatDetector
A lightweight, high-performance .NET library for offline file type identification based on file paths or raw data streams.
Overview
FormatDetector provides a simple way to identify the type of a file without relying solely on file extensions. By analyzing both file signatures and metadata, it can identify over 2,000+ generic file types. It supports both direct file paths and Stream objects (FileStream and MemoryStream), making it ideal for desktop tools and background processing. Because it operates entirely offline, it is ideal for secure environments, local processing, and high-speed applications where network latency is not an option.
Key Features
- Lightweight: Minimal dependencies, designed for .NET Framework 4.8.
- Dual Support: Identify files via
File Path StringorSystem IO Stream. - Detailed Metadata: Returns a
FileTypestructure containing the Extension, Type, and a descriptive Statement. - Trial Mode: Included "Freemium" logic allows for 30 trial detections per application lifetime unless a valid license key is provided.
Installation
Install the package via NuGet Package Manager:
Install-Package FormatDetector
Purchase
Purchase a license securely online.
Usage
Here is how to use FormatDetector in your C# project.
License Activation
If you have a license key, you can activate it to bypass the trial limit:
// Ensure you include the correct namespace
using FormatDetector;
// Activate your license key
bool isOk = FormatDetector.LicenseKey("your_license_key_here");
// Example check
Console.WriteLine(isOk.ToString());
Detecting File Types
You can detect a file type by providing a direct file path:
// Detect the format using a file path
var result = FormatDetector.Processor.Probe(@"Z:\File.ext");
// Access the properties
Console.WriteLine(result.Extension); // Extension
Console.WriteLine(result.File_Type); // File type
Console.WriteLine(result.Statement); // Detailed description
Quick One-Liners
If you need a quick identification without storing the object:
// From Stream:
Console.WriteLine(FormatDetector.Processor.Probe(stream).Statement);
// From File Path:
Console.WriteLine(FormatDetector.Processor.Probe(@"Z:\File.ext").Statement);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release.