Crates.io | unftp-sbe-fs |
lib.rs | unftp-sbe-fs |
version | 0.2.5 |
source | src |
created_at | 2021-03-26 21:52:55.083195 |
updated_at | 2024-05-16 22:14:18.616738 |
description | A storage back-end for libunftp, storing files on local disk |
homepage | https://github.com/bolcom/libunftp/tree/master/crates/unftp-sbe-fs |
repository | https://github.com/bolcom/libunftp/tree/master/crates/unftp-sbe-fs |
max_upload_size | |
id | 373963 |
size | 118,771 |
This unftp-sbe-fs crate allows you to use a regular Filesystem with libunftp and work like a regular FTP server.
If you've got Rust and cargo installed, create your project with
cargo new myftp
Add the libunftp and tokio crates to your project's dependencies in Cargo.toml
.
[dependencies]
libunftp = "0.20.0"
unftp-sbe-fs = "0.2.5"
tokio = { version = "1", features = ["full"] }
Now you're ready to develop your server!
Add the following to src/main.rs
:
use unftp_sbe_fs::ServerExt;
#[tokio::main]
pub async fn main() {
let ftp_home = std::env::temp_dir();
let server = libunftp::Server::with_fs(ftp_home)
.greeting("Welcome to my FTP server")
.passive_ports(50000..65535)
.build()
.unwrap();
server.listen("127.0.0.1:2121").await;
}
You can now run your server with cargo run
and connect to localhost:2121
with your favourite FTP client e.g.:
lftp -p 2121 localhost
For more help refer to:
Support is given on a best effort basis. You are welcome to engage us on the discussions page or create a Github issue.
You can also follow news and talk to us on Telegram
Thank you for your interest in contributing to unftp-sbe-fs!
Please feel free to create a Github issue if you encounter any problems.
Want to submit a feature request or develop your own storage or authentication back-end? Then head over to our contribution guide (CONTRIBUTING.md).
You're free to use, modify and distribute this software under the terms of the Apache License v2.0.