feat: implement streaming for large file handling

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-25 21:07:04 -03:00
parent 3478ffee2c
commit 1640932148
5 changed files with 165 additions and 48 deletions

View File

@@ -24,6 +24,21 @@ impl CompressionService {
reader.read_to_end(&mut content)?;
Ok(content)
}
pub fn stream_item_content(
&self,
item_path: PathBuf,
compression: &str,
) -> Result<Box<dyn Read + Send>, CoreError> {
let compression_type = CompressionType::from_str(compression)
.map_err(|e| CoreError::Compression(e.to_string()))?;
let engine = get_compression_engine(compression_type)
.map_err(|e| CoreError::Other(anyhow!(e.to_string())))?;
let reader = engine.open(item_path.clone())
.map_err(|e| CoreError::Other(anyhow!("Failed to open item file {:?}: {}", item_path, e)))?;
Ok(reader)
}
}
impl Default for CompressionService {