Skip to content

Commit cfebeb1

Browse files
committed
test(s3s): tokio_util StreamReader
1 parent 30bd9de commit cfebeb1

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/s3s/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ crc64fast-nvme = "1.2.0"
7070

7171
[dev-dependencies]
7272
tokio = { version = "1.40.0", features = ["full"] }
73+
tokio-util = { version = "0.7.13", features = ["io"] }

crates/s3s/tests/tokio_util.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use futures::TryStreamExt;
2+
use tokio::io::AsyncBufRead;
3+
use tokio_util::io::StreamReader;
4+
5+
pub fn convert_body(body: s3s::Body) -> impl AsyncBufRead + Send + Sync + 'static {
6+
StreamReader::new(body.into_stream().map_err(std::io::Error::other))
7+
}
8+
9+
pub fn convert_streaming_blob(blob: s3s::dto::StreamingBlob) -> impl AsyncBufRead + Send + Sync + 'static {
10+
StreamReader::new(blob.into_stream().map_err(std::io::Error::other))
11+
}

0 commit comments

Comments
 (0)