Skip to content

Commit 7f2e872

Browse files
committed
Add resume functionality
1 parent 35b2006 commit 7f2e872

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/ftp.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,13 @@ impl FtpStream {
435435
self.read_response(status::CLOSING).map(|_| ())
436436
}
437437

438+
/// Sets the byte from which the transfer is to be restarted.
439+
pub fn restart_from(&mut self, offset: u64) -> crate::Result<()> {
440+
let rest_command = format!("REST {}\r\n", offset.to_string());
441+
self.write_str(&rest_command)?;
442+
self.read_response(status::COMMAND_OK).map(|_| ())
443+
}
444+
438445
/// Retrieves the file name specified from the server.
439446
/// This method is a more complicated way to retrieve a file.
440447
/// The reader returned should be dropped.

0 commit comments

Comments
 (0)