Download latest file from s3 with ruby aws sdk
You'd probably be better off providing a url for users to download directly from S3 rather than trying to stream the file through your Rails app. It takes a bunch of options for expiration, security, caching, etc. A basic example:. So in your controller, you want to collect objects from the leaf nodes, not keys:.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Downloading S3 files objects using aws-sdk for ruby in rails Ask Question.
Asked 8 years, 3 months ago. Active 8 years, 1 month ago. Viewed 4k times. Jay Godse Edited my response below. Frederick Cheung Ive updated my original question to include my upload code as well Add a comment. Active Oldest Votes. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. After some research and a tip from a cousin of mine, i finally got this to work.
Here is the final code which made my day : require 'open-uri' open 'test. Improve this answer. It's the 'b' flag I was missing when opening the file! Thank you so much! Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast what if you could invest in your favorite developer?
Who owns this outage? Building intelligent escalation chains for modern SRE. Featured on Meta. Now live: A fully responsive profile. Reducing the weight of our footer. Linked 1. Related Hot Network Questions.
0コメント