$npx skillfedfor your agent

filetype

Infer file type and MIME type of any file/buffer. No external dependencies.

With conditionsPyPI SystemReleased Nov 202245.7M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — filetype-1.2.0-py2.py3-none-any.whl
v1.2.0 · released 2022-11-02

Yes, with conditions. Install if you need lightweight, dependency-free file type detection and can tolerate aging maintenance. The library is stable (Production/Stable classifier), has no known vulnerabilities, and handles a wide range of formats. However, the last release was 2022-11-02 with no recent commits, so it may not support the newest file formats or receive bug fixes promptly. Best suited for established use cases (common image, video, audio, archive, and document formats) rather than cutting-edge format support.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction: pure Python, no compiled dependencies or external libraries.
  • Maintenance is aging—last release was 2022-11-02 and the repository shows no recent commits, though it remains archived=false and has accumulated 770 stars.

License · maintenance · safety

MIT (permissive) — MIT license (permissive) means you can use this freely in commercial and private projects with minimal restrictions.

last release 2022-11-02 (1381 days) · last repo commit 2025-05-02 · 770 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 45,723,141 downloads/mo, #618 on PyPI

Verify before relying

pip install filetype

import filetype

kind = filetype.guess('sample.jpg')
if kind:
    print(kind.extension, kind.mime)
  • Whether the package still handles modern file formats reliably given the aging maintenance status.
  • Performance characteristics when processing large files or many files in sequence.
Same gist for agents: .md · .json

What it is and what it does

filetype is a lightweight Python library that identifies file types and MIME types by reading the magic number signatures (file headers) at the start of a file or byte buffer. It requires only the first 261 bytes of a file, making it efficient even for large files. The library is pure Python with no external dependencies—no C extensions, no libmagic bindings—and works across platforms.

You use it to determine what kind of file you're dealing with: image formats (jpg, png, webp, heic, avif, etc.), video formats (mp4, mkv, webm, mov, etc.), audio formats (mp3, flac, wav, aac, etc.), archives (zip, tar, gz, 7z, rar, etc.), documents (pdf, docx, xlsx, pptx, etc.), and fonts. It can also discover files by extension, MIME type, or category (image, video, audio, etc.), and supports custom type matchers for non-standard formats.

Use it for

  • Validate uploaded files in web applications by checking actual file type rather than trusting user-supplied extensions.
  • Automatically categorize media files in batch processing pipelines by kind (image, video, audio) without external tools.
  • Identify archive formats before extraction to route them to the correct decompression handler.
  • Detect file type from byte buffers (e.g., from network streams or database BLOBs) without writing to disk.
  • Build file discovery tools that group or filter files by MIME type or category across mixed directories.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, with conditions.

Install if you need lightweight, dependency-free file type detection and can tolerate aging maintenance. The library is stable (Production/Stable classifier), has no known vulnerabilities, and handles a wide range of formats. However, the last release was 2022-11-02 with no recent commits, so it may not support the newest file formats or receive bug fixes promptly. Best suited for established use cases (common image, video, audio, archive, and document formats) rather than cutting-edge format support.

Install

filetype on PyPI

Before you install

Low install friction: pure Python, no compiled dependencies or external libraries. Maintenance is aging—last release was 2022-11-02 and the repository shows no recent commits, though it remains archived=false and has accumulated 770 stars.

License in practice

MIT license (permissive) means you can use this freely in commercial and private projects with minimal restrictions.

Quickstart

pip install filetype

import filetype

kind = filetype.guess('sample.jpg')
if kind:
    print(kind.extension, kind.mime)

Verify before relying

  • Whether the package still handles modern file formats reliably given the aging maintenance status.
  • Performance characteristics when processing large files or many files in sequence.

Package facts

LicenseMIT permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceAging 1,381 days since the last release
Last repo commit
First released
Downloads45,723,141 / month, #618 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableEnvironment :: ConsoleEnvironment :: Web EnvironmentIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: SystemTopic :: System :: FilesystemsTopic :: Utilities

Evidence: filetype-1.2.0-py2.py3-none-any.whl

Tags

Capabilities
file type detectionmime type inferencemagic number checkingfile format identificationfile signature analysisidentify file typesdetect media types
Topics
file-identificationno-dependencies
PyPI keywords
filelibmagicmagicinfernumbersmagicnumbersdiscoverymimetypekind

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “mime type inference”

  • filetypeInfers file type and MIME type by examining magic number signatures…
  • zope.contenttypeGuesses MIME types from filenames and body data, parses MIME type…
  • python-mimeparseParses and matches MIME types against media-ranges according to RFC…

Give your agent the search over MCP, or paste the wish link into any chat.

More System packages

filelock Worth it
PyPI · Libraries · released Aug 2026

Provides a platform-independent file locking mechanism to coordinate access to files across processes and threads.

MITpure Python · 3.10+
717.1Mdownloads / mo
distro Worth it
PyPI · Python Modules · released Dec 2023

Distro provides a reliable, machine-readable API to query the Linux or BSD distribution name, version, codename, and other OS platform details, replacing Python's deprecated `platform.linux_distribution` function.

Install it if you need to detect or report the Linux/BSD distribution your code runs on.

Apache-2.0pure Python · 3.6+
417.9Mdownloads / mo
psutil Worth it
PyPI · Libraries · released Jan 2026

psutil retrieves real-time information about running processes and system resources (CPU, memory, disks, network, sensors) across multiple operating systems, enabling system monitoring, process profiling, and resource management.

permissive licensecompiled wheel · 3.6+
387.6Mdownloads / mo
pexpect With conditions
PyPI · Software Development · released Nov 2023

Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.

ISCpure Pythonaging
200.8Mdownloads / mo
aiofile Worth it
PyPI · Libraries · released Aug 2026

Provides asynchronous file I/O operations for asyncio programs, with automatic selection of the best available backend (io_uring, libaio, thread-based, or pure Python) depending on your system.

Apache-2.0pure Python · 3.11+
75.4Mdownloads / mo
portalocker Worth it
PyPI · Libraries · released Aug 2026

Portalocker provides cross-platform file locking with support for exclusive and shared locks, plus Redis-based distributed locks and process-aware PID file locking.

Install it if you need file or process coordination; the optional extras (pywin32, redis) are only required for specific lock types.

BSD-3-Clausepure Python · 3.10+
65.1Mdownloads / mo

See also magika · puremagic · python-magic · cigam · typecode · python-magic-bin · file-magic · libmagic · crewai-files · mediatype