3 unstable releases
| 0.8.6 | Dec 14, 2025 |
|---|---|
| 0.8.2 | Dec 14, 2025 |
| 0.6.2 | Dec 2, 2025 |
#257 in HTTP client
Used in 7 crates
38KB
707 lines
lighty-core
Core utilities for LightyLauncher.
Note
This is an internal crate for the LightyLauncher ecosystem. Most users should use the main lighty-launcher crate instead.
Features
- Async Downloads: Concurrent downloads with retry logic and SHA1 verification
- Archive Extraction: Support for ZIP, TAR, and TAR.GZ formats
- System Detection: OS and architecture detection
- Hosts Management: HTTP client with custom user agent
- Error Handling: Comprehensive error types with thiserror
Usage
[dependencies]
lighty-core = "0.6.3"
use lighty_core::download::download_file;
use lighty_core::system::{get_os, get_architecture};
#[tokio::main]
async fn main() {
// Detect system
let os = get_os();
let arch = get_architecture();
println!("Running on {:?} {:?}", os, arch);
// Download file
let path = download_file(
"https://example.com/file.zip",
"/tmp/file.zip",
Some("expected-sha1-hash")
).await?;
}
Structure
lighty-core/
└── src/
├── lib.rs # Module declarations and re-exports
├── download.rs # Async file downloads with SHA1 verification
├── extract.rs # Archive extraction (ZIP, TAR, TAR.GZ)
├── system.rs # OS and architecture detection
├── hosts.rs # HTTP client with custom user agent
├── hash.rs # Hash utilities (SHA1, SHA256 verification)
├── errors.rs # Error types (DownloadError, ExtractError, SystemError)
└── macros.rs # Utility macros
Modules
download- Async file downloads with retry logic and SHA1 verificationextract- Archive extraction for ZIP, TAR, and TAR.GZ formatssystem- Cross-platform OS and architecture detectionhosts- Shared HTTP client with appropriate user agenterrors- Comprehensive error types with thiserrormacros- Utility macros for common patterns
License
MIT
Links
- Main Package: lighty-launcher
- Repository: GitHub
- Documentation: docs.rs/lighty-core
Dependencies
~17–42MB
~665K SLoC