file_to_source_item

Function file_to_source_item 

Source
fn file_to_source_item(
    path: &Path,
    relative_path: &str,
    source: &str,
    fs_config: &FilesystemConnectorConfig,
) -> Result<Option<SourceItem>>
Expand description

Convert a single file to a SourceItem, or None if the file should be skipped (spec §2.2).

For files with a supported binary extension (.pdf, .docx, .pptx, .xlsx), reads raw bytes and returns an item with raw_bytes set and empty body. Otherwise reads as UTF-8; on decode failure and binary extension, falls back to raw bytes; else skips (returns None).