Python library to identify file type based on its file signature
Project description
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
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
filext-0.2.2.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file filext-0.2.2.tar.gz
.
File metadata
- Download URL: filext-0.2.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26f4630c7ccd5c21ad7dcc46ac38414383212ae06abc38e62a732406f1510690 |
|
MD5 | f718a8ff9b4f533a250afb88d1be6521 |
|
BLAKE2b-256 | 62cbc82bd6a61d805aa53920e7dd374a5b51686f23b7e3320bb10490bd734fe0 |
File details
Details for the file filext-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: filext-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7083a30889366302167642e61fd6155f3bbf51e8e8b15b1ebf3cc9e4663529c9 |
|
MD5 | 836c05062ffb7f74fb6faf779187cd1c |
|
BLAKE2b-256 | 3ec6034e5a10e8c4d48864334c04510bd61837c6e63ef7cb88be91f0e8e75c6f |