All Projects → floyernick → Fleep Py

floyernick / Fleep Py

Licence: mit
File format determination library for Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Fleep Py

Github Stars Manager
Chrome extension that allows you to manage your Github stars with tags, and to create a bookmark folder with all your stars organized by the tags you created
Stars: ✭ 183 (-17.57%)
Mutual labels:  extension
Rester
A REST client for almost any web service (Firefox and Chrome Extension)
Stars: ✭ 192 (-13.51%)
Mutual labels:  extension
Matio
MATLAB MAT File I/O Library
Stars: ✭ 206 (-7.21%)
Mutual labels:  file-format
Naughtyattributes
Attribute Extensions for Unity
Stars: ✭ 2,641 (+1089.64%)
Mutual labels:  extension
Vscode Vlang
V Language extension for Visual Studio Code.
Stars: ✭ 190 (-14.41%)
Mutual labels:  extension
Vscode React Native
VSCode extension for React Native - supports debugging and editor integration
Stars: ✭ 2,366 (+965.77%)
Mutual labels:  extension
Min Vid
Popout video player in Firefox
Stars: ✭ 180 (-18.92%)
Mutual labels:  extension
Facebook Political Ads
Monitoring Facebook Political Ads
Stars: ✭ 215 (-3.15%)
Mutual labels:  extension
Postgresql Unit
SI Units for PostgreSQL
Stars: ✭ 191 (-13.96%)
Mutual labels:  extension
Preact Devtools
Browser extension for inspection Preact applications
Stars: ✭ 204 (-8.11%)
Mutual labels:  extension
Cleanclosurexcode
An Xcode Source Editor extension to clean the closure syntax.
Stars: ✭ 186 (-16.22%)
Mutual labels:  extension
Tabio
An open source tab manager for Chrome
Stars: ✭ 190 (-14.41%)
Mutual labels:  extension
Githuboriginalstreak
Extension to get back current and longest streak. Original version ⭐️ All Browsers 💥
Stars: ✭ 200 (-9.91%)
Mutual labels:  extension
Hyperborder
adds a gradient border to the Hyper terminal
Stars: ✭ 183 (-17.57%)
Mutual labels:  extension
Xmark
A PHP7 extension that can hook most functions/classes and parts of opcodes
Stars: ✭ 209 (-5.86%)
Mutual labels:  extension
Gopassbridge
A web extension for firefox and chrome to insert login credentials from gopass
Stars: ✭ 182 (-18.02%)
Mutual labels:  extension
Emoji Helper
A small cross-browser emoji cheatsheet extension 👍
Stars: ✭ 194 (-12.61%)
Mutual labels:  extension
Klog
A plain-text file format and command line tool for time tracking
Stars: ✭ 222 (+0%)
Mutual labels:  file-format
Sketchup Stl
A SketchUp Ruby Extension that adds STL (STereoLithography) file format import and export.
Stars: ✭ 214 (-3.6%)
Mutual labels:  extension
Code D
Fully featured D language extension for Visual Studio Code using Serve-D
Stars: ✭ 202 (-9.01%)
Mutual labels:  extension

fleep

File format determination library for Python

|pypi version| |python version| |license|

Getting Started

fleep is a library that determines file format by file signature (also known as "magic number").

Installation

You can install fleep using pip. Simply run in CLI:

::

pip install fleep

Requirements

  • Python >= 3.1

In Use

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:

  • type -> list of suitable file types
  • extension -> list of suitable file extensions
  • mime -> list of suitable file MIME types

You may presume that first element in list will be the most suitable.

Also an instance of class Info has the following methods:

  • type_matches() -> checks if file type matches with given type as an argument
  • extension_matches() -> checks if file extension matches with given extension as an argument
  • mime_matches() -> checks if file MIME type matches with given MIME type as an argument

There are 3 more functions:

  • supported_types() -> returns a list of supported file types
  • supported_extensions() -> returns a list of supported file extensions
  • supported_mimes() -> returns a list of supported file MIME types

Examples

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

Tests

You can find tests in tests folder. There are results of speed test:

Workstation

  • Python 3.6 x64 bit
  • Windows 10 Home x64 bit
  • Intel Pentium G4620 3.70GHz
  • Kingston DDR4-2400 8192MB
  • Kingston SSD 120GB 550MB/s

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 | +-----------+---------+-----------+-----------+

Supported Formats

There is a list of supported formats (in alphabetical order):

Raster Image:

  • BMP
  • GIF
  • ICO
  • JP2
  • JPEG
  • PNG
  • PSD
  • TIFF
  • WEBP

Raw Image:

  • ARW
  • CR2
  • CRW
  • DNG
  • ERF
  • NEF
  • NRW
  • ORF
  • PEF
  • RAF
  • RAW
  • RW2
  • SRW
  • X3F

Vector Image:

  • AI
  • EPS

3D Image:

  • C4D
  • FBX
  • MA
  • MS3D
  • MTL
  • OBJ
  • PLY
  • WRL
  • X3D
  • XSI

Audio:

  • AAC
  • AC3
  • AIFF
  • AMR
  • AU
  • FLAC
  • M4A
  • MIDI
  • MKA
  • MP3
  • OGA
  • RA
  • VOC
  • WAV
  • WMA

Video:

  • 3G2
  • 3GP
  • ASF
  • AVI
  • FLV
  • M4V
  • MKV
  • MOV
  • MP4
  • MPG
  • OGV
  • SWF
  • VOB
  • WEBM
  • WMV

Document:

  • DOC
  • DOCX
  • EPUB
  • KEY
  • NUMBERS
  • ODP
  • ODS
  • ODT
  • PAGES
  • PDF
  • PPS
  • PPT
  • PPTX
  • RTF
  • XLS
  • XLSX
  • XML

Archive:

  • 7Z
  • DMG
  • GZ
  • ISO
  • RAR
  • TAR.Z
  • ZIP

Executable:

  • COM
  • EXE
  • JAR

Font:

  • OTF
  • TTF
  • WOFF
  • WOFF2

System:

  • CAB
  • CAT
  • DLL
  • DRV
  • REG
  • SDB
  • SYS

Database:

  • SQLITE

Changelog

You can find changelog in CHANGELOG.md file.

License

This project is licensed under the MIT License.

Authors

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].