Commit cfebeb13 authored by Nugine's avatar Nugine
Browse files

test(s3s): tokio_util StreamReader

parent 30bd9def
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2087,6 +2087,7 @@ dependencies = [
 "thiserror",
 "time",
 "tokio",
 "tokio-util",
 "tower",
 "tracing",
 "transform-stream",
+1 −0
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
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))
}