Understanding and controlling chunk size #2012
-
Hello everyone, I'm using use tokio_stream::StreamExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut stream = reqwest::get("http://www.baidu.com/")
.await?
.bytes_stream();
while let Some(item) = stream.next().await {
println!("chunk length: {}", item?.len());
}
Ok(())
} For
For
I apologize for bringing up this question here, but my attempts at finding meaningful answers have been overwhelmed by results related to If anyone could provide some insights, I would greatly appreciate it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The size of each "chunk" is not really specified on purpose, but I can explain some of the current implementation details. The size of any chunk is based on these criteria:
|
Beta Was this translation helpful? Give feedback.
The size of each "chunk" is not really specified on purpose, but I can explain some of the current implementation details. The size of any chunk is based on these criteria: