Skip to main content

FTP

FTP and FTPS services support.

Capabilities

This service can be used to:

  • stat
  • read
  • write
  • create_dir
  • delete
  • copy
  • rename
  • list
  • scan
  • presign
  • blocking

Configuration

  • endpoint: Set the endpoint for connection
  • root: Set the work directory for backend
  • user: Set the login user
  • password: Set the login password

You can refer to [FtpBuilder]'s docs for more information

Example

Via Builder

use anyhow::Result;
use opendal::services::Ftp;
use opendal::Operator;

#[tokio::main]
async fn main() -> Result<()> {
let mut builder = Ftp::default();

builder.endpoint("127.0.0.1");

let op: Operator = Operator::new(builder)?.finish();
Ok(())
}

Via Config

use anyhow::Result;
use opendal::Operator;
use opendal::Scheme;
use std::collections::HashMap;

#[tokio::main]
async fn main() -> Result<()> {
let mut map = HashMap::new();
map.insert("endpoint".to_string(), "127.0.0.1".to_string());

let op: Operator = Operator::via_map(Scheme::Ftp, map)?;
Ok(())
}