| Crates.io | unftp-sbe-fatfs |
| lib.rs | unftp-sbe-fatfs |
| version | 0.1.0 |
| created_at | 2025-04-30 18:31:53.061184+00 |
| updated_at | 2025-04-30 18:31:53.061184+00 |
| description | A storage backend for libunftp that provides read-only access to FAT filesystem images |
| homepage | |
| repository | https://github.com/hannesdejager/unftp-sbe-fatfs |
| max_upload_size | |
| id | 1655301 |
| size | 210,203 |
A storage backend for libunftp that provides read-only access to FAT filesystem images.
While feeling nostalgic I implemented this storage backend for the libunftp FTP server library, allowing you to serve
files from FAT filesystem images (.img files) over FTP. The implementation is read-only, meaning clients can list
directories and download files, but cannot modify the filesystem. Supporting write operations wouldn't be out of the
question but perhaps less useful. For now this is it.
Add this to your Cargo.toml:
[dependencies]
unftp-sbe-fatfs = "0.1.0"
libunftp = "0.21.0"
tokio = { version = "1.44.2", features = ["full"] }
Here's a simple example of how to use this crate to serve a FAT image over FTP:
use libunftp::ServerBuilder;
use unftp_sbe_fatfs::Vfs;
#[tokio::main(flavor = "current_thread")]
async fn main() {
let addr = "127.0.0.1:2121";
let server = ServerBuilder::new(Box::new(move || Vfs::new("examples/my.img")))
.greeting("Welcome to my FAT image over FTP")
.passive_ports(50000..=65535)
.build()
.unwrap();
println!("Starting FTP server on {}", addr);
server.listen(addr).await.unwrap();
}
Once your FTP server is running, you can connect to it using an FTP client like lftp, a sophisticated file transfer program that supports multiple protocols including FTP:
# Connect to the server
lftp ftp://localhost:2121
# List files in the current directory
ls
# Change to a subdirectory
cd subdir
# Download a file
get filename.txt
# Mirror a directory (download all files)
mirror directory_name
# Exit lftp
exit
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request, especially if you want to implement the write operations.