{"id":24844645,"url":"https://github.com/ghost1face/filetypeinterrogator","last_synced_at":"2025-10-14T16:31:22.096Z","repository":{"id":44918731,"uuid":"43563550","full_name":"ghost1face/FileTypeInterrogator","owner":"ghost1face","description":"Determine file type by 'Magic Numbers'","archived":false,"fork":false,"pushed_at":"2025-04-09T04:17:40.000Z","size":17668,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-22T15:50:03.043Z","etag":null,"topics":["content-type","csharp","file-type-detection","file-types"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghost1face.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2015-10-02T16:24:09.000Z","updated_at":"2025-04-09T04:16:23.000Z","dependencies_parsed_at":"2023-01-11T17:22:42.538Z","dependency_job_id":null,"html_url":"https://github.com/ghost1face/FileTypeInterrogator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ghost1face/FileTypeInterrogator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghost1face%2FFileTypeInterrogator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghost1face%2FFileTypeInterrogator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghost1face%2FFileTypeInterrogator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghost1face%2FFileTypeInterrogator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghost1face","download_url":"https://codeload.github.com/ghost1face/FileTypeInterrogator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghost1face%2FFileTypeInterrogator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019573,"owners_count":26086752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["content-type","csharp","file-type-detection","file-types"],"created_at":"2025-01-31T09:31:27.818Z","updated_at":"2025-10-14T16:31:20.613Z","avatar_url":"https://github.com/ghost1face.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FileTypeInterrogator\n\nnetstandard library for detecting file types by 'magic numbers', similar to the `file` command in Linux/Unix. Useful for validating file uploads instead of trusting file extensions.\n\n[![.NET](https://github.com/ghost1face/FileTypeInterrogator/actions/workflows/dotnet.yml/badge.svg?branch=master)](https://github.com/ghost1face/FileTypeInterrogator/actions/workflows/dotnet.yml) \n[![NuGet](https://img.shields.io/nuget/v/FileTypeInterrogator.svg?style=flat-square\u0026label=nuget)](https://www.nuget.org/packages/FileTypeInterrogator/)\n\n# Usage\n\n```\nIFileTypeInterrogator interrogator = new FileTypeInterrogator();\n\nbyte[] fileBytes = File.ReadAllBytes(\"pdfFile.pdf\");\n\nFileTypeInfo fileTypeInfo = interrogator.DetectType(fileBytes);\n\nConsole.WriteLine(\"Name = \" + fileTypeInfo.Name);\nConsole.WriteLine(\"Extension = \" + fileTypeInfo.FileType);\nConsole.WriteLine(\"Mime Type = \" + fileTypeInfo.MimeType);\n\n// The following output would be displayed:\n// Name = Portable Document Format File\n// Extension = pdf\n// Mime Type = application/pdf\n```\n\nNotice that `IFileTypeInterrogator` was assigned, meaning custom implementations are welcomed.  File definitions are provided in the source and will be regularly updated, feel free to submit an issue or pull request to add other signatures.  To quickly provide support for a new signature, create an instance of `CustomFileTypeInterrogator`:\n\n```\nIFileTypeInterrogator interrogator = new CustomFileTypeInterrogator(\"path_to_custom_definitions_file\", Encoding.UTF8);\n\nFileTypeInfo fileTypeInfo = interrogator.DetectType(...);\n```\n\nIt is best to create a single instance and manage it's lifetime through an IOC/DI Container.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghost1face%2Ffiletypeinterrogator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghost1face%2Ffiletypeinterrogator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghost1face%2Ffiletypeinterrogator/lists"}