pub fn fetch_with_cache(
url: &str,
filename: &str,
cache_max_age: f64,
) -> Result<String, BraheError>Expand description
Fetch a file from a URL with file-based caching.
Checks for a cached copy first. If the cache file exists and is younger
than cache_max_age seconds, returns the cached content. Otherwise,
downloads from the URL and writes to cache before returning.
§Arguments
url- Full URL to fetchfilename- Local filename to use in the cache directorycache_max_age- Maximum cache age in seconds
§Returns
Result<String, BraheError>- File contents as a string