Add R2 support
This is mostly finished, the only problem with it currently is R2 puts only allow a stream of a known length. Currently this is done by using a FixedLengthStream or a request/response body. This is probably blocked until FixedLengthStream is implemented.
It looks like FixedLengthStream is also implemented. What is missing to get this merged?
It looks like
FixedLengthStreamis also implemented. What is missing to get this merged?
Just testing against workerd, I've been preoccupied with other things and US holidays so I haven't gotten a chance yet. I hope to have this merged and released this upcoming week.
Would love this 🎉
What is the hold up on this? Is there anything I can do to move this forward?
Would love to see this happen!
Could it make sense to allow a separate .into_body() on Object? This would allow better ergonomics with Option::and_then and it's the intended way of using the type in JS anyways, right?
Example:
let result = bucket.get(key).execute().await?;
match result {
None => Ok(None),
Some(body) => match body.body() {
None => Ok(None),
Some(body) => Ok(Some(serde_json::from_slice(&body.bytes().await?)?)),
},
}
I think this is fine, but a chain of and_then would be much nicer, and the only thing blocking that is the body.bytes() function, as it returns a reference to body, even though this doesn't really make sense. Just consuming body makes sense here (and in most cases).
It would be really great to see this go in! 🙂 Anything one could do to help?
Sadly not, I've been super swamped with other things so I haven't been able to circle back on this yet. I rebased it earlier this week, should just need testing against the production workerd runtime.
Sadly not, I've been super swamped with other things so I haven't been able to circle back on this yet. I rebased it earlier this week, should just need testing against the production workerd runtime.
The failing checks should be fixed with another rebase to main. 🙃
@zebp I noticed this PR does not include support for multipart uploads (which would be great to have for the sake of 1:1 feature equivalence), so I went ahead and implemented that in this branch. I will open a PR once this goes in. 🙂
When is it going to be released? I really need it right now 😅
When is it going to be released? I really need it right now 😅
Would love if this would be released as well 😍
@geekyayush If you want to start developing against the new API, you can use it today as follows:
[dependencies]
worker = { git = "https://github.com/cloudflare/workers-rs", branch = "main" }
— see here in the documentation
Not really something you want to do for production, but it works for trying it out 🙃