MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / dir_size

Function dir_size

cli/src/build.rs:230–242  ·  view source on GitHub ↗
(dir: &Path)

Source from the content-addressed store, hash-verified

228}
229
230fn dir_size(dir: &Path) -> Result<u64> {
231 let mut total = 0u64;
232 let entries = fs::read_dir(dir).with_context(|| format!("reading {}", dir.display()))?;
233 for entry in entries.flatten() {
234 let m = entry.metadata()?;
235 if m.is_dir() {
236 total = total.saturating_add(dir_size(&entry.path())?);
237 } else {
238 total = total.saturating_add(m.len());
239 }
240 }
241 Ok(total)
242}
243
244fn index_html(entry: &str) -> String {
245 INDEX_HTML.replace("__EDGE_ENTRY__", entry)

Callers 1

runFunction · 0.85

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected