veeso / suppaftp

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

[QUESTION] - Reading files when using AsyncFtpStream #41

Closed neil-morrison44 closed 1 year ago

neil-morrison44 commented 1 year ago

Hi,

I'm using AsyncFtpStream - I've been able to transfer the write, metadata, list methods etc alright, but ftp_stream.retr is causing issues. I'm not sure if I'm missing something simple or if it's an actual issue.

Since retr_as_buffer doesn't exist for the Async FTP Stream it'd be good to have an example in the docs for retr when using the async feature

Thanks

neil-morrison44 commented 1 year ago

Got it working using ftp_stream.retr_as_stream - would be nice if a particular async read approach was recommended in the docs

veeso commented 1 year ago

I don't know what could be causing the issue with retr maybe set_mode hasn't been called first for binary transfers? retr_as_buffer is unavailable on async since it's not supported by async-std. Anyway retr_as_stream should always be preferred IMO since it allows you to have full control of the stream, while retr is suitable for a simple and straightforward approach.