From 56e02e14279c4940bde768c1d8223ba2f010395d Mon Sep 17 00:00:00 2001 From: Mihai Galos Date: Thu, 4 Nov 2021 17:32:33 +0100 Subject: [PATCH] Add resume functionality --- src/ftp.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ftp.rs b/src/ftp.rs index 38526189..1845629e 100644 --- a/src/ftp.rs +++ b/src/ftp.rs @@ -435,6 +435,13 @@ impl FtpStream { self.read_response(status::CLOSING).map(|_| ()) } + /// Sets the byte from which the transfer is to be restarted. + pub fn restart_from(&mut self, offset: u64) -> crate::Result<()> { + let rest_command = format!("REST {}\r\n", offset.to_string()); + self.write_str(&rest_command)?; + self.read_response(status::REQUEST_FILE_PENDING).map(|_| ()) + } + /// Retrieves the file name specified from the server. /// This method is a more complicated way to retrieve a file. /// The reader returned should be dropped.