Cloudflare Worker on-fly zipping of R2 contents

I am trying to zip multiple R2 files using a worker and save the zip to R2. Ideally, I could stream the files in and stream the resulting zip back to R2 to avoid temp file storage limits. This can be down on AWS with S3 and Lambda but it isn’t clear to me if this is possible with Workers & R2.

Amazon example https://www.richardneililagan.com/posts/zip-files-in-amazon-s3/
Similar issue https://community.cloudflare.com/t/how-to-cloudflare-workers-zip-on-fly/270891

1 Like

Workers implement CompressionStream - Web APIs | MDN - if you can actually compress a large file within CPU time limits is another question that I haven’t tested.

2 Likes