Skip to content

Instantly share code, notes, and snippets.

@baconpat
Created May 21, 2011 21:02
Show Gist options
  • Save baconpat/984896 to your computer and use it in GitHub Desktop.
Save baconpat/984896 to your computer and use it in GitHub Desktop.
S3 upload with EventMachine and happening
require 'happening'
EM.run do
EventMachine::add_periodic_timer(1) { print "." }
item = Happening::S3::Item.new('my_bucket',
"22mb_file",
:aws_access_key_id => 'MY_ACCESS_KEY',
:aws_secret_access_key => 'my_secret_key',
:permissions => 'public-read')
item.put File.read("/tmp/22mb_file") do |response|
puts "Finished"
EM.stop
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment