18 releases (8 breaking)

0.9.0 Jan 1, 2025
0.8.2 Nov 23, 2024
0.8.0 Sep 19, 2024
0.7.0 Jul 12, 2024
0.2.0 Jul 31, 2022

#603 in Web programming

Download history 868/week @ 2024-09-20 721/week @ 2024-09-27 685/week @ 2024-10-04 474/week @ 2024-10-11 676/week @ 2024-10-18 544/week @ 2024-10-25 675/week @ 2024-11-01 601/week @ 2024-11-08 505/week @ 2024-11-15 731/week @ 2024-11-22 760/week @ 2024-11-29 941/week @ 2024-12-06 877/week @ 2024-12-13 410/week @ 2024-12-20 371/week @ 2024-12-27 721/week @ 2025-01-03

2,604 downloads per month
Used in 5 crates (4 directly)

Apache-2.0

55KB
1K SLoC

Cargo tests and formatting security audit

reqwest streams for Rust

Library provides HTTP response streaming support for reqwest:

  • JSON array stream format
  • JSON lines stream format
  • CSV stream
  • Protobuf len-prefixed stream format
  • Arrow IPC stream format

This type of responses are useful when you are reading huge stream of objects from some source (such as database, file, etc) and want to avoid huge memory allocation.

Quick start

Cargo.toml:

[dependencies]
reqwest-streams = { version = "0.9", features=["json", "csv", "protobuf", "arrow"] }

Example code:


use reqwest_streams::*;
use futures::stream::BoxStream;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Deserialize)]
struct MyTestStructure {
    some_test_field: String
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {

    let _stream = reqwest::get("http://localhost:8080/json-array")
        .await?
        .json_array_stream::<MyTestStructure>(1024);

    Ok(())
}

All examples available in examples directory.

To run example use:

# cargo run --example json-stream

Need server support?

There is the same functionality:

Licence

Apache Software License (ASL)

Author

Abdulla Abdurakhmanov

Dependencies

~6–20MB
~269K SLoC