Write CSV straight to disk as GZIP'd file?

I would like to skip the filesystem and upload the GZIP’d straight to S3, but I’m not sure how to add IO.new and upload = uploader.upload(bucket: ENV["AWS_BUCKET"], object: uploaded_filename, io: infile) in with the GZIP writer to get the desired effect.