Crate quickfetch
source ·Expand description
§QuickFetch
§A Library to Fetch well Quickly…
Developed by Mustafif Khan | MoKa Reads 2024
:warning: WORK IN PROGRESS AND NOT READY TO BE USED FOR PRODUCTION YET
This library is built to handle multiple requests within a Client (reqwest client which will handle it all under a Client Pool)
, cache the response results, and handle these asynchronously.
The goal is to be a one-stop shop for handling local package manager development to handle multiple packages with a local cache to easily update, get and remove the different responses.
§Usage
// examples/mufiz_pkg.rs
use std::path::PathBuf;
use quickfetch::package::SimplePackage;
use quickfetch::Fetcher;
use quickfetch::{pretty_env_logger, FetchMethod};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
pretty_env_logger::init();
let config_path = "examples/watch.toml";
let mut fetcher: Fetcher<SimplePackage> =
Fetcher::new(config_path, quickfetch::package::Mode::Toml, "mufiz").await?;
// To enable progress bar for fetching
// fetcher.set_notify_method(quickfetch::NotifyMethod::ProgressBar);
// Set the response method to BytesStream or Chunk for progress bars
// fetcher.set_response_method(quickfetch::ResponseMethod::BytesStream);
// Fetch the packages concurrently
// fetcher.fetch(FetchMethod::Concurrent).await?;
// Write the fetched packages to a directory
// fetcher.write_all(PathBuf::from("pkgs")).await?;
// To enable watching
fetcher.watching().await;
Ok(())
}§License
This project is licensed under the MIT License - see the LICENSE file for details.
Re-exports§
pub use bincode;pub use pretty_env_logger;pub use quickfetch_traits as traits;
Modules§
- Provides different types of encryption methods that can be used
- Provides structures that can be used as a Key and Value for Fetcher
- Provides different types of packages that can be used
Structs§
- Fetcher struct that will be used to fetch and cache data
Enums§
FetchMethodenum to specify the method of fetching the responseResponseMethodenum to specify the method of fetching the response
Functions§
- Returns the path to the home directory with the sub directory appended