How To Install python3-filetype on Debian 12
Introduction
In this tutorial we learn how to install python3-filetype
on Debian 12.
What is python3-filetype
python3-filetype is:
Small and dependency free Python module to infer file type and MIME type checking the magic numbers signature of a file or buffer (aka file pattern).
This is a Python port from filetype Go package.
Features:
- Simple and friendly API.
- Supports a wide range of file types.
- Provides file extension and MIME type inference.
- File discovery by extension or MIME type.
- File discovery by kind (image, video, audio…).
- Pluggable: add new custom type matchers.
- Fast, even processing large files.
- Only first 261 bytes representing the max file header is required, so you can just pass a list of bytes.
- Dependency free (just Python code, no C extensions, no libmagic bindings).
- Cross-platform file recognition.
Currently, the following patterns are recognised:
- Image: bmp, cr2, dwg, gif, heic, ico, jpg, jpx, jxr, png, psd, tif, xcf, webp.
- Video: avi, flv, m4v, mkv, mov, mp4, mpg, webm, wmv, 3gpp.
- Audio: aac, aiff, amr, flac, m4a, mid, mp3, ogg, wav.
- Archive: ar, br, bz2, cab, crx, dcm, deb, eot, epub, exe, gz, lz, lzo, lz4, nes, pdf, ps, rar, rpm, rtf, sqlite, swf, tar, xz, zip, Z, 7z.
- Font: otf, ttf, woff, woff2.
- Application: wasm.
This package contains the filetype module for Python 3 and an executable.
There are three methods to install python3-filetype
on Debian 12. We can use apt-get
, apt
and aptitude
. In the following sections we will describe each method. You can choose one of them.
Install python3-filetype Using apt-get
Update apt database with apt-get
using the following command.
sudo apt-get update
After updating apt database, We can install python3-filetype
using apt-get
by running the following command:
sudo apt-get -y install python3-filetype
Install python3-filetype Using apt
Update apt database with apt
using the following command.
sudo apt update
After updating apt database, We can install python3-filetype
using apt
by running the following command:
sudo apt -y install python3-filetype
Install python3-filetype Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude
using the following command.
sudo aptitude update
After updating apt database, We can install python3-filetype
using aptitude
by running the following command:
sudo aptitude -y install python3-filetype
How To Uninstall python3-filetype on Debian 12
To uninstall only the python3-filetype
package we can use the following command:
sudo apt-get remove python3-filetype
Uninstall python3-filetype And Its Dependencies
To uninstall python3-filetype
and its dependencies that are no longer needed by Debian 12, we can use the command below:
sudo apt-get -y autoremove python3-filetype
Remove python3-filetype Configurations and Data
To remove python3-filetype
configuration and data from Debian 12 we can use the following command:
sudo apt-get -y purge python3-filetype
Remove python3-filetype configuration, data, and all of its dependencies
We can use the following command to remove python3-filetype
configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge python3-filetype
Dependencies
python3-filetype have the following dependencies:
References
Summary
In this tutorial we learn how to install python3-filetype
package on Debian 12 using different package management tools: apt
, apt-get
and aptitude
.