# remote-fs
Unified **async** file operations over SMB / FTP / SFTP.
## Backends
| SMB | [`smb2`](https://crates.io/crates/smb2) |
| FTP | [`async-ftp`](https://crates.io/crates/async-ftp) |
| SFTP | [`async-ssh2-tokio`](https://crates.io/crates/async-ssh2-tokio) (+ `russh-sftp`) |
> Note: crates.io `tokio-ssh2` (0.0.1) is abandoned; `async-ssh2-tokio` is the maintained Tokio SSH/SFTP client.
## Usage
```rust
use remote_fs::{Client, FtpConfig, RemoteFileSystem, SmbConfig, SftpConfig};
#[tokio::main]
async fn main() -> remote_fs::Result<()> {
let mut ftp = Client::ftp(&FtpConfig::new("ftp.example.com", "user", "pass")).await?;
let mut sftp = Client::sftp(&SftpConfig::with_password("host", "user", "pass")).await?;
let mut smb = Client::smb(&SmbConfig::new("host", "share", "user", "pass")).await?;
let entries = ftp.list("/").await?;
ftp.write("/demo.txt", b"hello").await?;
ftp.download("/demo.txt", std::path::Path::new("./demo.txt")).await?;
ftp.disconnect().await?;
Ok(())
}
```