5

How can you stream from a hyper::body::Body to a file using tokio::io::AsyncWriteExt or tokio::io::{AsyncRead,AsyncWrite} traits. It seems like in 0.13.5, hyper::error::Error cannot be created, so converting from std::io::Error to hyper::error::Error is impossible in snippets like this:

req.into_body().try_fold(file, |file, chunk| async move {
    file.write_all(chunk.as_ref()).await.map(|_| file)
});

Is there a simple way to do this?

Dan Jenson
  • 961
  • 7
  • 20

0 Answers0