16 unstable releases (7 breaking)

new 0.8.1 Nov 7, 2024
0.7.0 Jul 12, 2024
0.5.1 Dec 8, 2023
0.4.0 Nov 9, 2023
0.2.0 Jul 31, 2022

#1879 in Asynchronous

Download history 509/week @ 2024-07-18 352/week @ 2024-07-25 318/week @ 2024-08-01 333/week @ 2024-08-08 655/week @ 2024-08-15 629/week @ 2024-08-22 487/week @ 2024-08-29 467/week @ 2024-09-05 618/week @ 2024-09-12 867/week @ 2024-09-19 739/week @ 2024-09-26 694/week @ 2024-10-03 522/week @ 2024-10-10 619/week @ 2024-10-17 595/week @ 2024-10-24 480/week @ 2024-10-31

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

Apache-2.0

54KB
985 lines

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.7", 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
~267K SLoC