FTP
FTP and FTPS services support.
Capabilities
This service can be used to:
- stat
- read
- write
- create_dir
- delete
- copy
- rename
- list
-
presign - blocking
Configuration
endpoint
: Set the endpoint for connectionroot
: Set the work directory for backenduser
: Set the login userpassword
: 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
- Rust
- Node.js
- Python
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(())
}
import { Operator } from "opendal";
async function main() {
const op = new Operator("ftp", {
endpoint: "127.0.0.1",
});
}
import opendal
op = opendal.Operator("ftp",
endpoint="127.0.0.1",
)