Is streaming to an R2 file possible?
I have an audio stream that continuously yields audio buffers to a
ReadableStream
. My goal is to take these buffers and upload them to Cloudflare R2, but Iām unsure of the best approach to achieve this.
Is it possible to stream upload to an R2 file without knowing the size in advance?
Thank you in advance š7 Replies
Got it. Any recommended workaround? I'm going to be generating huge buffers that go over the worker's memory limit.
multipart with chunks that fit within the memory?
worker reads e.g. 50mb from stream, uploads it as multipart, repeats until it reaches the end of the stream and then finalises the multipart upload
Good idea, how to handle the finalization though? Would this not require having to download all of the buffers at once before adding them together, going over alloted memory?
not with multipart, you can upload them separately
yeah think I'm going to do that then use an AWS lambda function to stitch them all together
thanks for the help
i dont know exactly what the lamba is required for but yeah sure
how else than with a service with higher memory limit would I be able to merge the separately uploaded files?