Async FTP PUT #4294
Answered
by
Darksonn
mihaigalos
asked this question in
Q&A
Async FTP PUT
#4294
-
Using let mut ftp_stream = FtpStream::connect((*parsed_ftp).server.clone()).await.unwrap();
let mut file = tokio::fs::File::open(&input).await.unwrap();
let mut reader_stream = ReaderStream::new(file);
let mut async_stream = async_stream::stream! {
while let Some(chunk) = reader_stream.next().await {
yield chunk;
}
}; How would it be best to read from the file stream and call ftp_stream
.put(&parsed_ftp.file, &mut async_stream)
.await
.unwrap(); Result: &mut async_stream)
^^^^^^^^^^^^^^^^^ the trait `AsyncRead` is not implemented for `AsyncStream<_, impl futures_util::Future>` |
Beta Was this translation helpful? Give feedback.
Answered by
Darksonn
Dec 2, 2021
Replies: 1 comment 6 replies
-
Just use the |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
mihaigalos
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just use the
tokio::fs::File
object directly without the stream stuff.