File.TypeChecker 1.0.3

There is a newer version of this package available.
See the version list below for details.
Install-Package File.TypeChecker -Version 1.0.3
dotnet add package File.TypeChecker --version 1.0.3
<PackageReference Include="File.TypeChecker" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add File.TypeChecker --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: File.TypeChecker, 1.0.3"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install File.TypeChecker as a Cake Addin
#addin nuget:?package=File.TypeChecker&version=1.0.3

// Install File.TypeChecker as a Cake Tool
#tool nuget:?package=File.TypeChecker&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

FileTypeChecker is a easy to use library that allows you to read file and recognize its type. This will help you to validate all files that is provided by external sources.

How it works?

FileTypeChecker use file's "magic numbers" to identifying its type. See more about Magic Numbers

How to use?

using (var fileStream = File.OpenRead("myFileLocation"))
{
    var isRecognizableType = FileTypeValidator.IsTypeRecognizable(fileStream);

    if (!isRecognizableType)
    {
        // Do something ...
    }

    IFileType fileType = FileTypeValidator.GetFileType(fileStream);
    Console.WriteLine("Type Name: {0}", fileType.Name);
    Console.WriteLine("Type Extension: {0}", fileType.Extension);
}

What types of file are supported?

Currently FileTypeChecker recognizes following file types:

  • JPEG
  • Bitmap
  • Portable Network Graphic
  • Graphics Interchange Format 87a
  • Graphics Interchange Format 89a
  • Tagged Image File Format
  • Portable Document Format
  • Microsoft Office Document
  • eXtensible Markup Language
  • RAR archive version 1.50
  • RAR archive version 5.00
  • Photoshop Document file
  • ZIP file
  • eXtensible ARchive format
  • TAR Archive
  • 7-Zip File Format
  • GZIP compressed file
  • DOS MZ executable
  • Executable and Linkable Format
  • Audio Video Interleave video format
  • MPEG-1 Layer 3 file
  • MP3 file with an ID3v2 container
  • ISO9660 CD/DVD image file

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on File.TypeChecker:

Package Downloads
File.TypeChecker.Web

Don't let users to inject you an invalid file! FileTypeChecker is a easy to use library that allows you to read file and recognize its type. This will help you to validate all files that is provided by external sources.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 272 11/16/2021
2.0.3 152 11/11/2021
1.5.3 198 10/29/2021
1.5.2 6,502 8/2/2021
1.5.1 12,641 4/30/2021
1.4.0 20,918 11/24/2020
1.3.3 3,436 10/20/2020
1.3.2 3,634 10/4/2020
1.3.1 31,289 5/15/2020
1.3.0 3,015 5/7/2020
1.2.0 916 3/14/2020
1.1.0 263 3/7/2020
1.0.4 570 10/5/2019
1.0.3 370 10/5/2019
1.0.1 359 10/5/2019
1.0.0 391 10/4/2019

Adding support for more types.