Python package for getting identifying file types, based on Rust's file_type crate.
Project description
filetype_py
This is a quick and dirty Python package for identifying file types, based on Rust's file_type crate.
It is not to be confused with filetype, a package written in pure Python, and it's possible you may want something written in that instead. I made this before I realized that package existed, but I'm continuing to upload it because the Rust library supports more types then the python version (upwards of 10,000+).
Usage
import file_type
import sys
if(len(sys.argv)) <= 1:
print(sys.argv[0]+" <filetype>")
exit(0)
# Get the file type information about the given file
file = file_type.filetype_from_file(sys.argv[1])
# There is also filetype_from_bytes, filetype_from_media_type, and filetype_from_extension
# Print what the file type is, as a human readable string
print("Name:", file.name())
# Print the ID of the file type, corresponding to the table at https://github.com/theseus-rs/file-type/blob/main/FILETYPES.md
print("ID:", file.id())
# Print the extension(s) that this file type usually has.
print("Extensions:", file.extensions())
# Print the 'source type' of the file. This is what provided the information the library uses to determine the file, i.e. ICANN or Wikidata.
print("Source Type:", file.source_type())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file filetype_py-1.0.0.tar.gz.
File metadata
- Download URL: filetype_py-1.0.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1651792c35e9bc207699984b5a43bec2ea2ad1ea6ba01e5cb0f50fdea89562b2
|
|
| MD5 |
2192667ef27d8186dc8e33326da4381c
|
|
| BLAKE2b-256 |
476df21010c18f4942cea4c20e0b1101b06c4c0a5e45802e8de12f3bd751caaf
|
File details
Details for the file filetype_py-1.0.0-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: filetype_py-1.0.0-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17f0739fa470f9ad8188d61ae35b1b254e0079502b2cb28491679f507bc325e5
|
|
| MD5 |
4e960aadcd0d5431c92661556c7d9347
|
|
| BLAKE2b-256 |
dab8ddacc40d284cf4f1d194937dae621ef8f183aea75f1a51aac482c8929ddb
|
File details
Details for the file filetype_py-1.0.0-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: filetype_py-1.0.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
034ee7bc99f81cc3756b537d7320db2eccf32351b785f6bd7b1e36c4e02d8483
|
|
| MD5 |
a48050034fc4cf5489166038fbd20aa5
|
|
| BLAKE2b-256 |
59d2715282b377388d0996e4d5eb414505739d064c96c72e6a328e3cd6dea282
|