awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
ahupp avatar

ahupp/python-magic

0
View on GitHub↗
2,886 stars·306 forks·Python·other·17 views

Python Magic

python-magic is a C-binding wrapper that provides a Python interface for the libmagic system library. It functions as a file signature analyzer and MIME type detector, identifying file formats by comparing header bytes against a database of known binary signatures.

The library enables the identification of file types from both file paths and raw data buffers. It supports custom file signature matching through the injection of user-provided magic databases, allowing for the detection of specialized or proprietary formats.

The project covers binary data analysis and MIME type mapping to translate internal identification codes into standardized media type strings.

Features

  • Magic Byte File Identification - Identifies file types by matching header magic bytes against a database of known binary signatures.
  • Binary Data Analysis - Examines byte streams and buffers to determine the original file format or encoding.
  • libmagic Wrappers - Acts as a Python wrapper for the libmagic C library to identify file types via header bytes.
  • MIME Type Detection - Determines the human-readable description or MIME type of data streams and byte buffers.
  • MIME Type Detectors - Determines the MIME type of files and data buffers based on the magic database.
  • File Type Inference - Determines the format of a file by comparing its header bytes against a database of signatures.
  • MIME Type Mappings - Translates internal identification codes into standardized internet media type strings for interoperability.
  • Custom Magic Databases - Supports the use of custom signature databases to detect specialized or proprietary file formats.
  • File Signature Analyzers - Compares file byte sequences against a database to produce human-readable descriptions of file formats.
  • Custom Signature Matching - Uses specialized magic databases to identify proprietary or niche file formats.
  • In-Memory Byte Stream Processing - Provides the ability to analyze binary data sequences directly in memory to identify file types without disk persistence.
  • C-Library Bindings - Provides a Python interface for programmatic access to the underlying libmagic C library.
  • Data Loading Extraction - Wrapper for libmagic.
  • File System Utilities - Interface for libmagic to detect file types.

Star history

Star history chart for ahupp/python-magicStar history chart for ahupp/python-magic

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Open-source alternatives to Python Magic

Similar open-source projects, ranked by how many features they share with Python Magic.
  • sindresorhus/file-typesindresorhus avatar

    sindresorhus/file-type

    4,297View on GitHub↗

    file-type is a binary file type detector that identifies file extensions and MIME types by analyzing magic numbers and signature bytes in binary data. It functions as a magic number parser and MIME type resolver, mapping binary signatures to standardized media type strings. The project is an extensible file format identifier that allows for the addition of custom detector plugins to recognize uncommon or non-binary file formats. The engine supports binary format identification across various data sources, including buffers and data streams. It utilizes a supported format registry and provide

    JavaScript
    View on GitHub↗4,297
  • apache/tikaapache avatar

    apache/tika

    3,572View on GitHub↗

    Tika is a content analysis toolkit and Java library designed for detecting and extracting metadata and text from thousands of different file types. It functions as a universal document text extractor and metadata extraction engine, converting complex files into plain text or XHTML. The system employs a specialized MIME type detector that identifies document formats using magic bytes and metadata to determine the correct parser. It serves as an OCR integration gateway, connecting to external text recognition tools to extract content from image files. The project covers a broad range of extrac

    Javacontentextractionjava
    View on GitHub↗3,572
  • thephpleague/mime-type-detectionthephpleague avatar

    thephpleague/mime-type-detection

    1,338View on GitHub↗

    Mime Type Detection is a PHP library for determining and mapping media types from file contents, paths, or extensions using fallback lookup strategies. It provides utilities for inspecting file metadata and resolving file formats within PHP applications. The library supports bidirectional mapping between file extensions and media types through static community-curated mapping tables alongside content-based inspection. It includes extension-to-media-type mapping, reverse lookups from media types to valid file extensions, and fallback resolution chains that attempt content inspection before fal

    PHP
    View on GitHub↗1,338
  • bioruebe/uniextract2Bioruebe avatar

    Bioruebe/UniExtract2

    4,344View on GitHub↗

    UniExtract2 is a suite of tools designed for universal archive extraction, batch decompression, and file format analysis. It retrieves files from various compressed formats, software installers, disk images, and game archives into local directories. The project includes a file format analyzer that identifies file types by scanning internal contents and headers without requiring full extraction. It also features an archive password decrypter that attempts to recover access to protected archives using a predefined list of common passwords. The tool supports bulk decompression workflows through

    AutoItdecompressionextractorfile-analysis
    View on GitHub↗4,344
See all 30 alternatives to Python Magic→

Frequently asked questions

What does ahupp/python-magic do?

python-magic is a C-binding wrapper that provides a Python interface for the libmagic system library. It functions as a file signature analyzer and MIME type detector, identifying file formats by comparing header bytes against a database of known binary signatures.

What are the main features of ahupp/python-magic?

The main features of ahupp/python-magic are: Magic Byte File Identification, Binary Data Analysis, libmagic Wrappers, MIME Type Detection, MIME Type Detectors, File Type Inference, MIME Type Mappings, Custom Magic Databases.

What are some open-source alternatives to ahupp/python-magic?

Open-source alternatives to ahupp/python-magic include: sindresorhus/file-type — file-type is a binary file type detector that identifies file extensions and MIME types by analyzing magic numbers and… apache/tika — Tika is a content analysis toolkit and Java library designed for detecting and extracting metadata and text from… thephpleague/mime-type-detection — Mime Type Detection is a PHP library for determining and mapping media types from file contents, paths, or extensions… bioruebe/uniextract2 — UniExtract2 is a suite of tools designed for universal archive extraction, batch decompression, and file format… kreuzberg-dev/kreuzberg — Kreuzberg is a document extraction engine that converts PDFs, Office files, images, and over 90 other formats into… ldqk/masuit.tools — Masuit.Tools is a comprehensive static utility library for .NET and ASP.NET Core development. It provides a broad…