The disadvantage of providing the client with a zip file of all files is that you need to first pull all the files from S3 back to your server, and then secure them.
You can do this if you want, but it will take a little time, you will not want to do this synchronously, as part of a browser request. Instead, do it as a background job using delayed_job or the like.
To do the actual zipping, use Zlib :: GzipWriter. See http://ruby-doc.org/core/classes/Zlib/GzipWriter.html - this is part of the standard Ruby
Could you:
- write the user the actual zip file as an attachment
- write the user a link to the zip file on your server.
- or upload the zip file to s3, then send the link to the zip file to s3
/, zip ...
, , .
S3 URL- S3, . ( S3, .) , -fu aws-s3 gem:
def authenticated_s3_url
connect_to_aws
S3Object.url_for(full_filename,
bucket_name,
:expires_in => 60 * 60)
end