codygriffin
05/06/2022, 6:39 PMVitali
05/06/2022, 6:58 PM$ cat wrangler.toml
name = "demo-r2"
compatibility_date = "2022-03-13"
account_id = "...."
usage_model = "unbound"
workers_dev = true
main = "src/index.ts"
[[r2_buckets]]
binding = 'BUCKET'
bucket_name = 'my-bucket'
lpellegr
05/06/2022, 8:11 PMBurrito
05/06/2022, 8:23 PMVitali
05/06/2022, 8:48 PMErisa | Support Engineer
05/06/2022, 10:58 PMErisa | Support Engineer
05/06/2022, 10:59 PMJames
05/06/2022, 11:00 PMVitali
05/06/2022, 11:29 PMVitali
05/06/2022, 11:29 PMErisa | Support Engineer
05/06/2022, 11:30 PMVitali
05/06/2022, 11:31 PMconst object = await R2.get('key does not exist')
vs
const object = await R2.get('key does exist', { onlyIf: { etagMatches: "abc" } })
In both cases object
ends up null
...Vitali
05/06/2022, 11:32 PMconst object = await R2.get('key does not exist', { onlyIf: { etagMatches: "abc" } })
Vitali
05/06/2022, 11:33 PMonlyIf
should return a different kind of object maybe.Erisa | Support Engineer
05/06/2022, 11:33 PMnull
if the obejct doesnt exist and some kind of error object if it does exist but the etag doesnt matchErisa | Support Engineer
05/06/2022, 11:33 PMVitali
05/06/2022, 11:34 PMError
with an error messageErisa | Support Engineer
05/06/2022, 11:35 PMonlyIf: { etagMatches
compared to getting the R2 object and then checking its etag yourself?Vitali
05/06/2022, 11:35 PMVitali
05/06/2022, 11:35 PMbody
isn't retrieved and it's faster. But maybe then we return R2Object | R2ObjectBody | null
Erisa | Support Engineer
05/06/2022, 11:36 PMErisa | Support Engineer
05/06/2022, 11:37 PMVitali
05/06/2022, 11:37 PMErisa | Support Engineer
05/06/2022, 11:38 PMVitali
05/06/2022, 11:38 PMErisa | Support Engineer
05/06/2022, 11:39 PMR2Object | R2ObjectBody | null
idea entail/solve?Vitali
05/06/2022, 11:39 PMbody
Erisa | Support Engineer
05/06/2022, 11:40 PMErisa | Support Engineer
05/06/2022, 11:40 PMWallacy
05/06/2022, 11:43 PM