Working examples of streaming to r2 inside of a worker?

I'm working on an upload api that takes in a body, and sends it to r2, but needs to scan the data as it's coming in. We can't hold this in memory due to worker limits, and the cloudflare docs state: "To ensure memory usage does not reach this limit, consider using Streams." but only link to the streams APIs. Curious on if anybody has working examples of how to do this in a worker? We keep getting the error: Error: The script will never generate a response.
2 Replies
ItsWendell
ItsWendell4mo ago
Is it just a text stream?
Obo
OboOP4mo ago
@ItsWendell anything in a request body. Could be text, could be an image, video, etc
Want results from more Discord servers?
Add your server