Expand description
§codewalk
Fast, security-aware file tree walker for codebase scanning.
Every security tool that scans codebases needs the same thing: walk a
directory tree, skip binaries and huge files, respect .gitignore, and
read file contents efficiently. This crate does all of that.
§Usage
use codewalk::{CodeWalker, WalkConfig};
let config = WalkConfig::default();
let walker = CodeWalker::new("/path/to/repo", config);
for entry in walker.walk().unwrap() {
println!(
"{} ({} bytes, binary={})",
entry.path.display(),
entry.size,
entry.is_binary
);
if let Ok(content) = entry.content() {
// scan the content...
let _ = content.len();
}
}Modules§
- error
- Error types returned by codewalk APIs.
Structs§
- Code
Walker - File tree walker for codebase scanning.
- File
Entry - A discovered file entry with lazy content loading.
- Walk
Config - Configuration for directory walking.
Traits§
- File
Source - Trait for anything that walks files and yields entries.
Functions§
- is_
binary - Check if a file is binary using magic bytes and extension heuristics.
- scan_
files - Convenience: walk and read all text files, returning
(path, content)pairs. Propagates walk, I/O, and UTF-8 errors instead of silently dropping files.