Write stream chunks directly to the output stream #2854
Unanswered
mokhaled2992
asked this question in
Q&A
Replies: 2 comments 3 replies
-
First, you can use But really, you can already take the body of the request as a stream and simply map it to the output you want and return that. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Instead of writing to a |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I'm aware that there are 3 types of response bodies:
I'm interested in the stream where I have a vector of inputs and I want to convert it on the fly to a stream of bytes send it back as a chunked response (
transfer-encoding: chunked
). However, for the stream response type you have to yield chunks. I implemented the following working solution which provides an async stream that yields chunks of bytes. Is there any way to write directly to the output stream without going over this hop of creating and yielding intermediate buffers?axum version
0.7.5
Beta Was this translation helpful? Give feedback.
All reactions