Skip to main content

Guess a files type from its content and extension

Project description

File Type Guesser

Test PyPI PyPI - Python Version PyPI - Downloads License MIT Open Issues Line Count Last Commit

Guess a file's type from its content and extension.

This is intended to be a pure Python implementation of something like python-magic. This means it should work on all platforms that can run Python as it does not require external binaries like libmagic.

This project currently is not heavily tested and not fully feature complete

Example Of Use

from pathlib import Path
from file_type_guesser import guess_file

path = Path("README.md")
guess = guess_file(path)
print(guess)
ContentGuess(category=<FileTypes.TEXT: 1>, extention='md', content_ext='md')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

file-type-guesser-0.2.0.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

file_type_guesser-0.2.0-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page