Last active
December 17, 2015 08:29
-
-
Save kylev/5580361 to your computer and use it in GitHub Desktop.
Examples for streaming data to/from S3 via Fog.
This file contains hidden or 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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is for my blog entry, Foggy Sponges and Kittens.