remote_fs/lib.rs
1//! Unified async remote file operations over **SMB**, **FTP**, and **SFTP**.
2//!
3//! # Features
4//!
5//! | Feature | Backend |
6//! |---------|---------|
7//! | `ftp` | [`async-ftp`](https://crates.io/crates/async-ftp) |
8//! | `smb` | [`smb2`](https://crates.io/crates/smb2) |
9//! | `sftp` | [`async-ssh2-tokio`](https://crates.io/crates/async-ssh2-tokio) |
10//! | `full` | `smb` + `ftp` + `sftp` |
11//!
12//! ```toml
13//! remote-fs = { version = "0.1", features = ["ftp"] }
14//! remote-fs = { version = "0.1", features = ["full"] }
15//! ```
16//!
17//! # Quick start
18//!
19//! ```no_run
20//! # #[cfg(feature = "ftp")]
21//! # {
22//! use remote_fs::{Client, FtpConfig, RemoteFileSystem};
23//!
24//! # #[tokio::main]
25//! # async fn main() -> Result<(), remote_fs::Error> {
26//! let cfg = FtpConfig::new("ftp.example.com", "user", "pass");
27//! let mut client = Client::ftp(&cfg).await?;
28//! let entries = client.list("/").await?;
29//! client.write("/hello.txt", b"hello").await?;
30//! client.disconnect().await?;
31//! # Ok(())
32//! # }
33//! # }
34//! # #[cfg(not(feature = "ftp"))]
35//! # fn main() {}
36//! ```
37
38mod client;
39mod error;
40mod traits;
41mod types;
42
43#[cfg(feature = "ftp")]
44mod ftp;
45#[cfg(feature = "sftp")]
46mod sftp;
47#[cfg(feature = "smb")]
48mod smb;
49
50pub use client::{Client, ClientBuilder};
51pub use error::{Error, Result};
52pub use traits::RemoteFileSystem;
53pub use types::{Config, FileEntry, FileMeta, Protocol};
54
55#[cfg(feature = "ftp")]
56pub use ftp::FtpClient;
57#[cfg(feature = "ftp")]
58pub use types::FtpConfig;
59
60#[cfg(feature = "sftp")]
61pub use sftp::SftpClient;
62#[cfg(feature = "sftp")]
63pub use types::SftpConfig;
64
65#[cfg(feature = "smb")]
66pub use smb::SmbClient;
67#[cfg(feature = "smb")]
68pub use types::SmbConfig;