r2 file upload¶
… put a file into r2 through a Worker:
const filename = crypto.randomUUID()
const uploadedObject = await env.bucketName.put(filename, request.body, {
httpMetadata: request.headers,
})
return new Response(filename, { headers: { etag: uploadedObject?.httpEtag } })
then upload with curl like so: