Git Product home page Git Product logo

fileextension's Introduction

FileExtension

GitHub repo Questions at StackOverflow Ask a question at StackOverflow Community discussions License codecov Nuget .NET Docs Maintainability Rating

What it does

This project helps you to see that a file has the correct extension

What it recognize

There are 344 extensions of files ( 16 tested) . See https://fileextension.readthedocs.io/en/latest/BDD/LightBDDReport/

Please help by making a PR by adding files to https://github.com/ignatandrei/FileExtension/tree/master/src/TestFileExtensions/TestFiles

How to use it

Demo online: https://fileextension.azurewebsites.net/swagger/index.html

NuGet Package: Nuget

Simple use

.NET / C#

Add a reference to Nuget ,

var r = new RecognizerPlugin.RecognizePlugins();
//foreach (var item in r.AllExtensions())
//{
//    Console.WriteLine(item);
//}
//find the sln on the path
string file = FindSlnToBeRecognized();
//found sln, now recognize
var byts = await File.ReadAllBytesAsync(file);

//find short way - directly
var foundDirectly = r.Is_SLN(byts);
Console.WriteLine($"file {file} is recognized {foundDirectly}");
// or long way
//find extension
var fileExtension = Path.GetExtension(file);
// find if there is a recognizer for the extension
var canRecognize = r.CanRecognizeExtension(fileExtension);
Console.WriteLine($"file {file} can be  recognized {canRecognize}");
if (canRecognize)
{
	//now see if the content matches the bytes
	var found = r.RecognizeTheFile(byts, fileExtension);
	Console.Write($"file {file} is recognized {found}");
}

Angular / TypeScript

For calling the service , please see https://github.com/ignatandrei/FileExtension/blob/master/src/FileExtensionAng/src/app/services/FileExtv1.service.ts

For a component, please see https://github.com/ignatandrei/FileExtension/tree/master/src/FileExtensionAng/src/app/file-ext-v1

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Andrei Ignat

⚠️ 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Links

Licence

The code in this project is licensed under MIT license.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.