Crate ftp [] [src]

ftp is an FTP client written in Rust.


Here is a basic usage example:

use ftp::FtpStream;
let mut ftp_stream = FtpStream::connect("").unwrap_or_else(|err|
    panic!("{}", err)
let _ = ftp_stream.quit();


The client supports FTPS on demand. To enable it the client should be compiled with feature openssl enabled what requires openssl dependency.

The client uses explicit mode for connecting FTPS what means you should connect the server as usually and then switch to the secure mode (TLS is used). For better security it's the good practice to switch to the secure mode before authentication.

FTPS Usage

use ftp::FtpStream;
use ftp::openssl::ssl::*;

let ftp_stream = FtpStream::connect("").unwrap();
let ctx = SslContext::new(SslMethod::Sslv23).unwrap();
let ssl = Ssl::new(&ctx).unwrap();
// Switch to the secure mode
let mut ftp_stream = ftp_stream.into_secure(ssl).unwrap();
ftp_stream.login("anonymous", "anonymous").unwrap();
// Do other secret stuff
// Switch back to the insecure mode (if required)
let mut ftp_stream = ftp_stream.into_insecure().unwrap();
// Do all public stuff
let _ = ftp_stream.quit();


pub use self::types::FtpError;



The set of valid values for FTP commands



Stream to interface with the FTP server. This interface is only for the command stream.