pub fn tags_from_path<P: AsRef<Path>>(path: P) -> Result<TagSet>Expand description
Identify a file from its filesystem path.
This is the most comprehensive identification method, providing a superset of information from other methods. It analyzes:
- File type (regular file, directory, symlink, socket)
- File permissions (executable vs non-executable)
- Filename and extension patterns
- File content (binary vs text detection)
- Shebang lines for executable files
§Arguments
path- Path to the file to identify
§Returns
A set of tags identifying the file type and characteristics.
§Errors
Returns IdentifyError::PathNotFound if the path doesn’t exist, or
IdentifyError::IoError for other I/O failures.
§Examples
use file_identify::tags_from_path;
let tags = tags_from_path(&file_path).unwrap();
assert!(tags.contains("file"));
assert!(tags.contains("python"));
assert!(tags.contains("text"));