You have a filename. You still do not know whether to treat it as binary.
A scanner hits thousands of paths. An upload lands with an odd name. A pipeline has to decide whether to open a file, quarantine it, or pass it along. Guessing from a short list you typed last year is how webp slips through and your weekend turns into list maintenance.
Binary Extensions gives you one shared answer: a curated set of 250+ binary extensions, ported from the binary-extensions npm package, in a small Python library you can drop in today.
Probably binary? Check the extension first.
What you get
- A fast yes or no from the path alone. Check a bare extension or a full path before you spend time reading bytes.
- One list that stays in sync with a familiar standard. You inherit hundreds of known binary types across images, video, archives, documents, fonts, and executables without writing JSON by hand.
- Matching that survives real filenames. Case-insensitive, dot-aware checks, including dotfiles such as
.DS_Store. - Cheap bulk filters. Membership lives in an immutable frozenset so directory walks and batch gates stay light.
- The raw set when you need it. Import the full extension collection, or a lowercase copy, for custom rules and reporting.
- No dependency chain. Zero third-party packages beyond the standard library you already run.
Picture your Tuesday
You are building a folder sweep before a deeper virus scan (an illustrative example). Every path gets one quick gate: if it looks binary by extension, it goes to the slow queue. If not, it can skip the heavy step. You are not claiming perfect security. You are stopping obvious media, archives, and executables from clogging the line.
Ready to try it?
Requires Python 3.8 or newer.






