Skip to main content

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

  • PDF
  • DOC
  • PPT
  • XLS
  • DOCX
  • PPTX
  • XLSX

Images

  • BMP
  • GIF
  • HEIC
  • JPG
  • PNG
  • TIF

Metadata

Release files for filext 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for filext 0.2.2
File Size Uploaded
filext-0.2.2.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for filext 0.2.2
File Interpreter ABI Platform
filext-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / filext-0.2.2.tar.gz

Download URL filext-0.2.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
26f4630c7ccd5c21ad7dcc46ac38414383212ae06abc38e62a732406f1510690
BLAKE2b-256 checksum
How to use checksums
62cbc82bd6a61d805aa53920e7dd374a5b51686f23b7e3320bb10490bd734fe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release files / filext-0.2.2-py3-none-any.whl

Download URL filext-0.2.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7083a30889366302167642e61fd6155f3bbf51e8e8b15b1ebf3cc9e4663529c9
BLAKE2b-256 checksum
How to use checksums
3ec6034e5a10e8c4d48864334c04510bd61837c6e63ef7cb88be91f0e8e75c6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page