veeso / suppaftp

a super FTP/FTPS client library for Rust with support for both passive and active mode
Apache License 2.0
121 stars 31 forks source link

[Feature Request] - Support MLST and MLSD #76

Closed mousetail closed 6 months ago

mousetail commented 7 months ago

Description

The MLST and MLSD commands allow getting more detailed metadata about a file.

Changes

Add something like this:

fn mlsd(pathname: Option<&str>) -> Vec<FileInfo>{

}

fn mlst(pathname: &str) -> FileInfo {

}

struct FileInfo {
    pathname: String,
    size: Option<usize>,
    created: Option<DateTime>,
    modified: Option<DateTime>,
    type: Option<TypeFact>,
    unique: Option<String>,
    perm: Option<String>,
    lang: Option<String>,
    media_type: Option<String>,
    charset: Option<String>,
    custom: HashMap<String, String>
}

enum TypeFact {
    File,
    Directory,
    CurrentDirectory,
    ParentDirectory
}

Implementation

Should be fairly straightforward

constituent commented 6 months ago

I want these commands as well, but when I searched the doc and found nothing, my intuition was searching for some api to send raw command. After reading source code, I was surprised to find ImplAsyncFtpStream.perform being private. Is there a reason that sending raw command not public? It forbids users to utilize lots of advanced features.

veeso commented 6 months ago

Reference https://www.rfc-editor.org/rfc/rfc3659#page-23

veeso commented 6 months ago

701071d6