Skip to main content

Crate kget

Crate kget 

Source
Expand description

§KGet - A Powerful Download Library for Rust

kget provides robust downloading capabilities for modern applications:

  • HTTP/HTTPS downloads with parallel connections (up to 32x speed)
  • FTP/SFTP support for legacy and secure file transfers
  • BitTorrent via magnet links with native client (requires torrent-native feature)
  • ISO verification with automatic SHA-256 integrity checking
  • Auto-optimization based on file type and network conditions

§Quick Start

use kget::{download, DownloadOptions, Config, ProxyConfig, Optimizer};

// Simple download
let config = Config::default();
let proxy = ProxyConfig::default();
let optimizer = Optimizer::new();
download("https://example.com/file.zip", false, None, &config, proxy, optimizer).unwrap();

§Advanced Download with Progress

use kget::{AdvancedDownloader, ProxyConfig, Optimizer};
use std::sync::Arc;

let mut downloader = AdvancedDownloader::new(
    "https://example.com/large.iso".to_string(),
    "large.iso".to_string(),
    false,
    ProxyConfig::default(),
    Optimizer::new(),
);

// Set progress callback
downloader.set_progress_callback(Arc::new(|progress| {
    println!("Progress: {:.1}%", progress * 100.0);
}));

downloader.download().unwrap();

§Torrent Downloads

use kget::torrent::{download_magnet, TorrentCallbacks};
use kget::{ProxyConfig, Optimizer};
use std::sync::Arc;

let callbacks = TorrentCallbacks {
    status: Some(Arc::new(|msg| println!("Status: {}", msg))),
    progress: Some(Arc::new(|p| println!("Progress: {:.1}%", p * 100.0))),
};

download_magnet(
    "magnet:?xt=urn:btih:...",
    "./downloads",
    false,
    ProxyConfig::default(),
    Optimizer::new(),
    callbacks,
).unwrap();

§Features

  • gui - Cross-platform GUI using egui (includes torrent-native)
  • torrent-native - Native BitTorrent client using librqbit
  • torrent-transmission - Transmission RPC integration

Re-exports§

pub use config::Config;
pub use config::ProxyConfig;
pub use config::ProxyType;
pub use download::download;
pub use download::verify_iso_integrity;
pub use advanced_download::AdvancedDownloader;
pub use optimization::Optimizer;
pub use progress::create_progress_bar;
pub use torrent::download_magnet;
pub use torrent::TorrentCallbacks;
pub use utils::get_filename_from_url_or_default;
pub use utils::resolve_output_path;
pub use utils::print;

Modules§

advanced_download
Advanced parallel download functionality with resume support.
config
Configuration management for KGet.
download
Simple HTTP/HTTPS download functionality.
ftp
FTP download support.
optimization
Download optimization through compression and caching.
prelude
Prelude module for convenient imports
progress
Progress bar utilities for download visualization.
sftp
SFTP (SSH File Transfer Protocol) download support.
torrent
BitTorrent download support.
utils
Utility functions for KGet.

Structs§

DownloadOptions
Options for configuring a download operation.

Type Aliases§

ProgressCallback
Type alias for progress callbacks (0.0 to 1.0)
StatusCallback
Type alias for status message callbacks