![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
File format determination library for Python
|pypi version| |python version| |license|
fleep is a library that determines file format by file signature (also known as "magic number").
You can install fleep using pip. Simply run in CLI:
::
pip install fleep
fleep has main function get() that determines file format. It takes byte sequence (128 bytes are enough) as an argument and returns an instance of class Info with the following arguments:
You may presume that first element in list will be the most suitable.
Also an instance of class Info has the following methods:
There are 3 more functions:
You can find examples in examples folder. There is a simple example:
.. code:: python
import fleep
with open("png_image", "rb") as file:
info = fleep.get(file.read(128))
print(info.type) # prints ['raster-image']
print(info.extension) # prints ['png']
print(info.mime) # prints ['image/png']
print(info.type_matches("raster-image")) # prints True
print(info.extension_matches("gif")) # prints False
print(info.mime_matches("image/png")) # prints True
You can find tests in tests folder. There are results of speed test:
Workstation
Results
Note: 0.0012345 -> time in seconds
+-----------+---------+-----------+-----------+ | Iteration | Minimum | Maximum | Average | +===========+=========+===========+===========+ | 1 | 0.0 | 0.0005312 | 0.0000851 | +-----------+---------+-----------+-----------+ | 2 | 0.0 | 0.0005360 | 0.0000858 | +-----------+---------+-----------+-----------+ | 3 | 0.0 | 0.0005236 | 0.0000837 | +-----------+---------+-----------+-----------+ | 4 | 0.0 | 0.0005035 | 0.0000833 | +-----------+---------+-----------+-----------+ | 5 | 0.0 | 0.0005295 | 0.0000835 | +-----------+---------+-----------+-----------+
There is a list of supported formats (in alphabetical order):
Raster Image:
Raw Image:
Vector Image:
3D Image:
Audio:
Video:
Document:
Archive:
Executable:
Font:
System:
Database:
You can find changelog in CHANGELOG.md file.
This project is licensed under the MIT License.
Mykyta Paliienko - GitHub profile
_
.. _GitHub profile: https://github.com/floyernick
.. |pypi version| image:: https://img.shields.io/badge/pypi-v1.0.1-blue.svg :target: https://pypi.python.org/pypi/fleep .. |python version| image:: https://img.shields.io/badge/python-3-blue.svg .. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg :target: https://github.com/floyernick/fleep/blob/master/LICENSE
FAQs
File format determination library
We found that fleep demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.