SC8
SC8
CDCloudflare Developers
Created by SC8 on 9/10/2024 in #workers-help
Not getting R2 file contents body from inside Worker
I can download a file from the console, so I can confirm the contents are there. From the shown worker code I do get back a file object, it just doesn't have a body. Any ideas? Thank you for any pointers... const content = await c.env.DEVME.get(fileName); if(!content) { return c.json({error: "File not found"}); } return c.json( { Url: c.req.url, FileName: fileName, Content: content, ContentBody: content.body, } ); outputs ... { "Url": "https://domain/19512", "FileName": "domain/19512.json", "Content": { "storageClass": "Standard", "range": { "offset": 0, "length": 2868 }, "customMetadata": {}, "httpMetadata": { "contentType": "application/json" }, "uploaded": "2024-09-10T01:18:38.267Z", "checksums": { "md5": "2f4654a-----fd9c0f6062f7" }, "httpEtag": ""2f4654-----fd9c0f6062f7"", "etag": "2f4654a06-----9c0f6062f7", "size": 2868, "version": "7e6e267-----69c651e3fde", "key": "domain/19512.json" }, "ContentBody": {} }
2 replies