Skip to main content

Crate unftp_sbe_fatfs

Crate unftp_sbe_fatfs 

Source
Expand description

A storage backend for libunftp that provides read-only access to FAT filesystem images.

This crate implements a storage backend for the libunftp FTP server library, allowing you to serve files from FAT filesystem images (.img files) over FTP.

§Example

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();
}

§Connecting with lftp

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

§Limitations

  • Read-only access (no file uploads, deletions, or modifications)
  • No support for symbolic links

Structs§

Meta
Metadata for files and directories in the FAT filesystem.
Vfs
A virtual file system that provides read-only access to FAT filesystem images.