which meant code like this (pseudo) was perfectly valid:
const file = await env.MY_BUCKET.get('file.txt');
let checksum: ArrayBuffer | null = null;
if(file?.checksums?.md5){
checksum = file.checksums.md5.slice(0, 8); // not really how this would work, but illustrates the change
}
Now (workers-types@4.20240603.0), it's defined like this:
Previously (
workers-types@4.20240529.0
), R2 checksums were defined like this:which meant code like this (pseudo) was perfectly valid:
Now (
workers-types@4.20240603.0
), it's defined like this:which implies you have to do
.buffer
on each of the checksums to access it, like:but this then throws a TypeError:
TypeError: Cannot read properties of undefined (reading 'slice')
I suspect this was caused by https://github.com/cloudflare/workerd/pull/2201. cc @jasnell