Skip to content

Commit 17e31bf

Browse files
authored
Merge pull request #11 from mihaigalos/add_resume
Add resume functionality
2 parents c938d71 + a76ae5f commit 17e31bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ftp.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ impl FtpStream {
288288
self.read_response(status::CLOSING).await?;
289289
Ok(())
290290
}
291+
/// Sets the byte from which the transfer is to be restarted.
292+
pub async fn restart_from(&mut self, offset: u64) -> Result<()> {
293+
let rest_command = format!("REST {}\r\n", offset.to_string());
294+
self.write_str(&rest_command).await?;
295+
self.read_response(status::REQUEST_FILE_PENDING).await.map(|_| ())
296+
}
291297

292298
/// Retrieves the file name specified from the server.
293299
/// This method is a more complicated way to retrieve a file.

0 commit comments

Comments
 (0)