binaryornot is an ultra-lightweight, pure Python package designed to check if a file is binary or text using simple heuristics. It is currently at version 0.6.0 and appears to have a slow but steady release cadence, primarily for Python version compatibility updates.
pip install binaryornotVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use the `is_binary` function to check both a generated text file and a generated binary file. It covers file creation, checking, and cleanup.
Understand that the detection is heuristic-based. For critical use cases where absolute certainty is required, consider using libraries that perform deeper file format analysis (e.g., python-magic) or explicit magic number checks if the expected format is known.
Always wrap calls to `is_binary` within `try...except` blocks to gracefully handle potential file system errors. Ensure the file path exists and the application has read permissions before invoking the function.
Use the correct import statement: `from binaryornot.binary import is_binary`.
Ensure the `binaryornot` package is installed using `pip install binaryornot` in the Python environment where the script is executed. Verify the package is listed when running `pip freeze` or `pip list`.
No dependency data recorded yet.