Skip to content

Commit

Permalink
test(s3s): tokio_util StreamReader
Browse files Browse the repository at this point in the history
  • Loading branch information
Nugine committed Mar 10, 2025
1 parent 30bd9de commit cfebeb1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/s3s/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ crc64fast-nvme = "1.2.0"

[dev-dependencies]
tokio = { version = "1.40.0", features = ["full"] }
tokio-util = { version = "0.7.13", features = ["io"] }
11 changes: 11 additions & 0 deletions crates/s3s/tests/tokio_util.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use futures::TryStreamExt;
use tokio::io::AsyncBufRead;
use tokio_util::io::StreamReader;

pub fn convert_body(body: s3s::Body) -> impl AsyncBufRead + Send + Sync + 'static {
StreamReader::new(body.into_stream().map_err(std::io::Error::other))
}

pub fn convert_streaming_blob(blob: s3s::dto::StreamingBlob) -> impl AsyncBufRead + Send + Sync + 'static {
StreamReader::new(blob.into_stream().map_err(std::io::Error::other))
}

0 comments on commit cfebeb1

Please sign in to comment.