Skip to content

Instantly share code, notes, and snippets.

@kylev
Last active December 17, 2015 08:29
Show Gist options
  • Save kylev/5580361 to your computer and use it in GitHub Desktop.
Save kylev/5580361 to your computer and use it in GitHub Desktop.
Examples for streaming data to/from S3 via Fog.
# Create happily takes IO-like objects as body.
file = directory.files.create(
:key => 'giant_linux_distro.iso',
:body => File.open("nightly.iso"), # No ma! No read()!
:public => true
)
# Get will take a block for streamy goodness.
directory.files.get("giant_thing.bin") do |chunk, remaining, total|
output.write(chunk)
end
@kylev
Copy link
Author

kylev commented May 15, 2013

This is for my blog entry, Foggy Sponges and Kittens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment