Pre-release
This release is a pre-release and may not be stable for production use.
guess-file-mime-type
A minimal, cross-platform, and cross-version utility to safely guess a file's MIME type.
Features
- ✅ NT & POSIX filesystem support
- ✅ Uniform API for different Python versions (2+ and 3.0 - 3.13+)
- Standard library functions like
mimetypes.guess_type()andmimetypes.guess_file_type()change signature and location in Python 3.13.
- Standard library functions like
- ✅ Returns sensible default (
application/octet-stream) for unknown types
Why?
- Write portable code that works everywhere, forever.
Installation
pip install guess-file-mime-type
Usage
# coding=utf-8
from __future__ import print_function
from guess_file_mime_type import guess_file_mime_type
mime_type = guess_file_mime_type('/path/to/image.png')
print(mime_type) # 'image/png'
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Release files for guess-file-mime-type 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| guess_file_mime_type-0.1.0a1.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| guess_file_mime_type-0.1.0a1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 5.8 kB
Release files / guess_file_mime_type-0.1.0a1.tar.gz
| Download URL | guess_file_mime_type-0.1.0a1.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44f45fdd80a6960c520297d0ec2c233e670151cb0ed8430cfabf6bc2e7364f48
|
|
BLAKE2b-256 checksum How to use checksums |
a6ab8064ad5b45cf32090d148afa91934fb733d19ebf7e5b6616d2f21cafd2ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / guess_file_mime_type-0.1.0a1-py2.py3-none-any.whl
| Download URL | guess_file_mime_type-0.1.0a1-py2.py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0fc0e501ccb22bd84f39238953f70b192350f16aba57c8799e2eafda434c089f
|
|
BLAKE2b-256 checksum How to use checksums |
59ffc42b163d5a1e800259c675b8e30c2d52cd6069beebbe23af655d2e85e2b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|