is_binary_content

Function is_binary_content 

Source
pub fn is_binary_content(content: &[u8]) -> bool
Expand description

Check if content appears to be binary by examining bytes

Uses a heuristic: if more than 10% of the first 8KB contains null bytes or other control characters, the file is considered binary.

§Arguments

  • content - Byte slice to check (typically first 8KB of file)

§Returns

true if the content appears to be binary

§Example

use infiniloom_engine::scanner::is_binary_content;

// Text content
assert!(!is_binary_content(b"fn main() { println!(\"hello\"); }"));

// Binary content (has null bytes)
assert!(is_binary_content(&[0x00, 0x01, 0x02, 0x00, 0x00]));