lazyget 0.1.2

Lazy artifact downloader with local caching
docs.rs failed to build lazyget-0.1.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

lazyget

Lazy artifact downloader with local caching.

Crates.io Documentation License: MIT License: Apache 2.0

lazyget provides a simple, atomic caching layer for downloading or generating artifacts. Perfect for build tools, template engines, or any workflow where you want to avoid redundant work.

Features

  • Atomic operations: Uses temp directories and atomic renames to prevent partial/corrupted cache entries
  • Sync & Async: Choose the API that fits your project
  • Zero-fuss: Only thiserror, sha2, and hex (async mode adds optional tokio)
  • Idempotent: Calling fetch multiple times with the same ID invokes your closure only once

Quick Start

Add to your Cargo.toml:

toml [dependencies] lazyget = "0.1"

Basic usage:

``rust use lazyget::{fetch, make_id};

let cache_dir = std::env::temp_dir().join("my-app-cache"); let id = make_id("https://example.com/artifact.zip", Some("v1.2.3"));

let path = fetch(&cache_dir, &id, |dir| { // Download or generate your artifact into dir std::fs::write(dir.join("result.txt"), "hello")?; Ok(()) })?;

println!("Artifact ready at: {:?}", path); ``

Documentation

Full API reference and advanced usage examples are available in the book.

License

MIT OR Apache-2.0