Skip to content

Commit c76fdc4

Browse files
🎏 Add ReadableStream to Data (#548)
1 parent 76c0c22 commit c76fdc4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

worker/src/r2/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,19 @@ pub(crate) enum ObjectInner {
452452
}
453453

454454
pub enum Data {
455+
ReadableStream(web_sys::ReadableStream),
455456
Stream(FixedLengthStream),
456457
Text(String),
457458
Bytes(Vec<u8>),
458459
Empty,
459460
}
460461

462+
impl From<web_sys::ReadableStream> for Data {
463+
fn from(stream: web_sys::ReadableStream) -> Self {
464+
Data::ReadableStream(stream)
465+
}
466+
}
467+
461468
impl From<FixedLengthStream> for Data {
462469
fn from(stream: FixedLengthStream) -> Self {
463470
Data::Stream(stream)
@@ -479,6 +486,7 @@ impl From<Vec<u8>> for Data {
479486
impl From<Data> for JsValue {
480487
fn from(data: Data) -> Self {
481488
match data {
489+
Data::ReadableStream(stream) => stream.into(),
482490
Data::Stream(stream) => {
483491
let stream_sys: EdgeFixedLengthStream = stream.into();
484492
stream_sys.readable().into()

0 commit comments

Comments
 (0)