bt_file_cache

Crates.iobt_file_cache
lib.rsbt_file_cache
version0.1.8
created_at2025-11-06 22:05:33.793149+00
updated_at2025-11-25 18:43:02.396119+00
descriptionA caching mechanism for downloading and storing files from URLs
homepagehttps://github.com/bachuetech/bt_file_cache
repositoryhttps://github.com/bachuetech/bt_file_cache.git
max_upload_size
id1920805
size88,930
(bachuetech)

documentation

README

Project Title

BT Cache

Description

A caching mechanism for downloading and storing files from URLs. It generates SHA3-512 hashes of URLs to create unique file names and manages local storage of cached files.

Usage

let cache = BTCache::new(Some("myapp"))?;
let base64_data = cache.get_file_data_base64("https://bachuetech.biz/fake_image.png")?;

match cache.refresh_cache("https://bachuetech.biz/fake_image.png") {
    Ok(file_path) => {
        // Proceed with fetching and storing new content at file_path
        println!("Cache refreshed. New content should be stored at: {}", file_path);
    }
    Err(e) => {
        // Handle the error appropriately
        eprintln!("Failed to refresh cache: {}", e);
    }
}

Version History

  • 0.1.0
    • Initial Release
  • 0.1.1
    • Added invalidate cache and refresh cache functions
  • 0.1.2
    • Update dependencies
  • 0.1.3
    • Added async functions for all the cache sync functions
  • 0.1.4
    • Validate URL in advance for better error messaging
  • 0.1.5
    • Added 10 seconds timeout to file download and default user agent
  • 0.1.6
    • Added functions supporting a file name/id as cache id
  • 0.1.7
    • Added functions supporting access to URL using access token
  • 0.1.8
    • Bug fix: fixed issue where token was not passed in some cases.
    • Check download response status and return an error for 400s or 500s.

License

GPL-3.0-only

Commit count: 0

cargo fmt