pub struct FtpDownloader { /* private fields */ }Expand description
FTP file downloader with progress tracking.
Supports:
- Anonymous FTP (use “anonymous” as username)
- Authenticated FTP with username/password in URL
- Binary transfer mode (safe for all file types)
- SOCKS5 proxy connections
§URL Format
ftp://[user[:password]@]host[:port]/path/to/file§Example
use kget::ftp::FtpDownloader;
use kget::{ProxyConfig, Optimizer};
// Anonymous download
let dl = FtpDownloader::new(
"ftp://ftp.gnu.org/gnu/emacs/emacs-28.2.tar.gz".to_string(),
"emacs-28.2.tar.gz".to_string(),
false,
ProxyConfig::default(),
Optimizer::new(),
);
dl.download().expect("FTP download failed");
// Authenticated download
let dl = FtpDownloader::new(
"ftp://user:pass@private-server.com/file.zip".to_string(),
"file.zip".to_string(),
false,
ProxyConfig::default(),
Optimizer::new(),
);
dl.download().expect("FTP download failed");Implementations§
Source§impl FtpDownloader
impl FtpDownloader
Sourcepub fn new(
url: String,
output_path: String,
quiet_mode: bool,
proxy: ProxyConfig,
optimizer: Optimizer,
) -> Self
pub fn new( url: String, output_path: String, quiet_mode: bool, proxy: ProxyConfig, optimizer: Optimizer, ) -> Self
Create a new FTP downloader.
§Arguments
url- FTP URL including path to fileoutput_path- Local path to save the filequiet_mode- Suppress console outputproxy- Proxy configuration (SOCKS5 only)optimizer- Optimizer instance
pub fn download(&self) -> Result<(), Box<dyn Error + Send + Sync>>
Auto Trait Implementations§
impl Freeze for FtpDownloader
impl RefUnwindSafe for FtpDownloader
impl Send for FtpDownloader
impl Sync for FtpDownloader
impl Unpin for FtpDownloader
impl UnsafeUnpin for FtpDownloader
impl UnwindSafe for FtpDownloader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more