-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CloudFlare R2 (http) #318
Comments
Hi dear @juretopolak. Feel free to draft a PR if you are willing to help supporting this driver earlier 👍🏼 |
Hi @pi0. I'm actually a TypeScript newbie, so I doubt my PR would be useful at all. 🙂 Maybe someday in the future... until then I'll keep learning and admiring the work you experts do. 👌 |
Hi @juretopolak I had to deal with this recently, I found that the best way is to use import { AwsClient } from 'aws4fetch'
const aws = new AwsClient({ accessKeyId, secretAccessKey })
// Then you can just send a PUT / GET / DELETE request
await aws.fetch(R2_BUCKET_URL, { body: buffer, method: 'PUT', ContentType: type }) It's super easy with |
Really nice find. I certainly like to consider aws4fetch. There are small items (such as crypto polyfill to use uncrypto) we can either (temporarily) inline impl to make those or work with @mhart if you would like to make it happen! |
I guess R2 http is kinda rare because it is an extra overhead if you upload a file to your API (which is not hosted on a Cloudflare worker) and then send the file to Cloudflare by another "upload". If you use Cloudflare R2 it makes sense if your api also runs und Cloudflare so there is no extra transfer from your API to R2. If you cant deploy to Cloudflare Workers, what you could also do is create an empty Nitro project and deploy it to Cloudflare Pages. Then use this one for file uploads directly from the client or with your api as a proxy. Btw. since R2 has a S3 api, maybe also this one works? |
(sorry i mistakenly closed issue. r2 over HTTP driver is not supported yet) |
S3 supported landed in #361 which is also tested against r2 over HTTP. for now only mentioned in docs in the future we might make a dedicated driver leveraging more native addons of cloudflare r2 if needed. |
Describe the feature
I would just like to ask if you have any approx. date when r2-http driver will be released? I would like to use CF R2 in the Node environment and I'm wondering if it is better to wait for a "native" nuxt/nitro/unstorage driver or the release is not close so it's better to go with another solution? 🙂
Thanks!
Additional information
Tasks
The text was updated successfully, but these errors were encountered: