filext
Python library to identify file type based on its file signature
Installation
pip install filext
Usage
If the category of the file is not certain, you may use whatfile but is a little slower
from filext import whatfile
file_path = "./tests/files/document.pdf"
# pass file as path str
file_type = whatfile(file_path)
with open(filepath, "rb") as file:
# pass file as bytes
file_type = whatfile(file.read())
If the category of the file is known, you may use the function for that category instead.
from filext import whatdoc
file_path = "./tests/files/document.pdf"
# pass file as path str
file_type = whatdoc(file_path)
with open(filepath, "rb") as file:
# pass file as bytes
file_type = whatdoc(file.read())
Supported File Types
Documents
- DOC
- PPT
- XLS
- DOCX
- PPTX
- XLSX
Images
- BMP
- GIF
- HEIC
- JPG
- PNG
- TIF
Metadata
Release files for filext 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| filext-0.2.2.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| filext-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.4 kB
Release files / filext-0.2.2.tar.gz
| Download URL | filext-0.2.2.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26f4630c7ccd5c21ad7dcc46ac38414383212ae06abc38e62a732406f1510690
|
|
BLAKE2b-256 checksum How to use checksums |
62cbc82bd6a61d805aa53920e7dd374a5b51686f23b7e3320bb10490bd734fe0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Release files / filext-0.2.2-py3-none-any.whl
| Download URL | filext-0.2.2-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7083a30889366302167642e61fd6155f3bbf51e8e8b15b1ebf3cc9e4663529c9
|
|
BLAKE2b-256 checksum How to use checksums |
3ec6034e5a10e8c4d48864334c04510bd61837c6e63ef7cb88be91f0e8e75c6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|