Flag binary-looking paths by extension, no extra dependencies
When it’s useful
Upload validation, scanners, and file workflows often need a fast “probably binary” signal before deeper inspection. Rolling your own extension list is easy to get wrong. This library mirrors the well-known binary-extensions npm dataset in Python so you can treat archives, media, executables, and similar types consistently.
What you can do
- Check an extension or a full path for a binary type, with case-insensitive, dot-aware matching (including dotfiles such as
.DS_Store). - Use a curated immutable set: 250+ binary extensions across images, audio, video, archives, documents, fonts, and executables.
- Keep checks cheap with
frozensetmembership. - Expose the sets (
BINARY_EXTENSIONS,BINARY_EXTENSIONS_LOWER) for custom filtering or reporting.
Limits and fit
This is extension-based heuristics, not magic-byte sniffing. A .txt file could hold binary data and a misnamed file could slip through; pair with real validation when security or correctness demands it. Python 3.8+; install from PyPI (binary-extensions). Full API and changelog are in the GitHub repository.



