Created
January 9, 2011 16:00
-
-
Save jeremywrowe/771776 to your computer and use it in GitHub Desktop.
grabbing object info from a bucket s3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "aws/s3" | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => 'KEY_GOES_HERE', | |
:secret_access_key => 'KEY_SECRET_GOES_HERE' | |
) | |
object = AWS::S3::S3Object.find 'OBJECT_NAME_GOES_HERE','BUCKET_NAME_GOES_HERE' | |
puts object.etag # MD5 SUM | |
object_in_megabytes = (object.size / 1024.0) / 1024.0 | |
puts "%.3fMb" % object_in_megabytes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment