MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / save_truncated

Method save_truncated

crates/opencode-tool/src/truncation.rs:71–87  ·  view source on GitHub ↗
(content: &str, save_dir: &Path)

Source from the content-addressed store, hash-verified

69 }
70
71 async fn save_truncated(content: &str, save_dir: &Path) -> std::io::Result<PathBuf> {
72 fs::create_dir_all(save_dir).await?;
73
74 let timestamp = SystemTime::now()
75 .duration_since(UNIX_EPOCH)
76 .map(|d| d.as_millis())
77 .unwrap_or(0);
78
79 let filename = format!("truncated_{}.txt", timestamp);
80 let filepath = save_dir.join(filename);
81
82 let mut file = fs::File::create(&filepath).await?;
83 file.write_all(content.as_bytes()).await?;
84 file.flush().await?;
85
86 Ok(filepath)
87 }
88
89 pub async fn cleanup(save_dir: &Path) -> std::io::Result<usize> {
90 if !save_dir.exists() {

Callers

nothing calls this directly

Calls 1

createFunction · 0.85

Tested by

no test coverage detected