Buffering BodyStream #2040
Unanswered
adeschamps
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm in a situation where I have a
BodyStream
and some function that runs on eachBytes
item that it yields, and the overhead of calling that function is significant enough that it would be beneficial to buffer the input and process largerBytes
on each call. I think there are two options I could consider:BodyStream
buffers larger chunks before my handler reads it.In the first case, I'm not sure whether this is an Axum question or a Hyper question, but is there a way to configure some buffering of the input?
In the second case, this clearly isn't an Axum-specific question, although if there's any advice for buffering a stream of
Result<Bytes, Error>
, I'd be interested -- something involvingtokio::io::BufReader
seems like it's what I want, except that I think I'd be converting fromBytes
to slices ofu8
and back toBytes
again.Beta Was this translation helpful? Give feedback.
All reactions