1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// File: src\binary.rs
// Author: Hadi Cahyadi <cumulus13@gmail.com>
// Date: 2026-05-11
// Description:
// License: MIT
use File;
use Read;
use Path;
/// Returns `true` when the file looks like binary content.
///
/// The heuristic reads the first `check_bytes` bytes of the file and checks:
/// * whether a null byte (`\0`) is present — classic binary signal
/// * whether the bytes fail UTF-8 decoding
///
/// Any IO error is treated conservatively as "binary" so the file is skipped.