{"categories":[{"label":"Utilities","url":"https://skillfed.io/packages/category/utilities/11"}],"enrichment":{"capability":"file-magic provides a Python interface to libmagic, enabling detection of file types, MIME types, and encodings from file paths or content.","skillfed_tags":["file-type-detection","ctypes-binding"],"use_cases":["Validate uploaded files in web applications by checking actual MIME type instead of trusting user-supplied extensions.","Automatically categorize files in batch processing pipelines based on detected type and encoding.","Build file management tools that need to identify file types for sorting, filtering, or routing decisions.","Detect character encoding of text files to handle them correctly during import or conversion workflows."],"what_it_does":"file-magic is a ctypes wrapper around the libmagic library, which is the same engine used by the Unix `file` command. It lets you identify what a file actually is\u2014its MIME type, character encoding, and human-readable type name\u2014by examining its content or path, rather than relying on file extensions.\n\nThe package has no Python runtime dependencies and installs as a pure wheel, making it lightweight to add to any project. It works by calling into the native libmagic library, so you need libmagic available on your system (usually pre-installed on Linux/macOS, or installable via package manager). The API is straightforward: pass a filename to `detect_from_filename()` and get back an object with `mime_type`, `encoding`, and `name` attributes.","worth_installing":"Yes. file-magic is a stable, low-friction wrapper around a well-established system library. It has no Python dependencies, installs cleanly, carries a permissive license, and solves a real problem\u2014reliable file type detection\u2014that's otherwise tedious to implement. The main gotcha is the libmagic system dependency, which is typically already present but must be verified in your deployment environment."},"id":"file-magic","links":{"html":"https://skillfed.io/packages/file-magic","md":"https://skillfed.io/packages/file-magic.md","pypi":"https://pypi.org/project/file-magic/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2022-09-01","license_spdx":null,"license_treatment":"permissive","name":"file-magic","python_support":"supports_current","summary":"Python front end for libmagic(3)"},"popularity":{"monthly_downloads":84589,"position":13984,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.4.1"}
