Skip to main content

is_binary

Function is_binary 

Source
pub fn is_binary(data: &[u8]) -> bool
Expand description

Centralized binary file detection.

Uses a heuristic based on the ratio of non-text bytes in the first 512 bytes. Valid UTF-8 multi-byte sequences (2-4 bytes) are counted as text, not binary, so files containing emoji or CJK characters are not falsely flagged.