FormatDetector 1.7.0

dotnet add package FormatDetector --version 1.7.0
                    
NuGet\Install-Package FormatDetector -Version 1.7.0
                    
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="FormatDetector" Version="1.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FormatDetector" Version="1.7.0" />
                    
Directory.Packages.props
<PackageReference Include="FormatDetector" />
                    
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 FormatDetector --version 1.7.0
                    
#r "nuget: FormatDetector, 1.7.0"
                    
#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 FormatDetector@1.7.0
                    
#: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=FormatDetector&version=1.7.0
                    
Install as a Cake Addin
#tool nuget:?package=FormatDetector&version=1.7.0
                    
Install as a Cake Tool

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 String or System IO Stream.
  • Detailed Metadata: Returns a FileType structure 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 Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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.

Version Downloads Last Updated
1.7.0 57 10/11/2026
1.6.0 51 10/9/2026
1.5.0 94 9/30/2026
1.4.0 92 9/26/2026
1.3.0 88 9/22/2026
1.2.0 95 9/20/2026
1.1.0 122 9/19/2026

Initial release.