Skip to content

neocrev/whatfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

whatfile

Show detailed metadata for any file -- images, audio, video, archives, PDFs, and more.

PyPI version Python versions License

Install

pip install whatfile

No heavy dependencies required. Optional backends (Pillow, tinytag, pypdf) add more detail automatically when installed.

Usage

whatfile photo.jpg song.mp3 video.mp4 archive.zip document.pdf script.py

Quick demo

whatfile terminal demo

Backends

Format Info shown Optional dep
JPEG, PNG, GIF, WebP, BMP, TIFF, AVIF dimensions, color mode, format pip install Pillow
MP3, FLAC, OGG, WAV, M4A, OPUS duration, bitrate, samplerate, tags pip install tinytag (or ffprobe)
MP4, MKV, AVI, MOV, WebM codec, resolution, fps, duration, bitrate ffprobe (from ffmpeg)
ZIP, TAR, GZ, BZ2, XZ, 7z, RAR file count, compressed/uncompressed size stdlib (7z/unrar for extra)
PDF pages, version, title, author pip install pypdf (or pdfinfo)
Any file size, permissions, MIME type none

Everything works out of the box. Optional backends enrich the output -- no errors if missing.

More examples

# Multiple files at once
whatfile report.pdf screenshot.png backup.tar.gz

# Wildcard (shell expansion)
whatfile ~/Music/*.flac

# All files in directory
whatfile ~/Downloads/*

How it works

whatfile classifies files by extension, then dispatches to the appropriate backend. Each backend inspects the file and returns structured metadata. A pretty box-drawing display renders the result.

Detection order per format:

  1. Image -- Pillow (if installed) extracts dimensions, mode, format
  2. Audio -- tinytag (if installed) for tags + codec info; falls back to ffprobe
  3. Video -- ffprobe for codecs, resolution, duration
  4. Archive -- stdlib zipfile/tarfile for entries + compression ratio; 7z/unrar subprocess for extra formats
  5. PDF -- pypdf (if installed) for pages, version, metadata; falls back to pdfinfo
  6. Generic -- os.stat for size/permissions; python-magic or file command for MIME type

License

MIT

About

Universal file metadata CLI — images, audio, video, archives, PDFs & more

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages