Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added cp_from_local method

  • Loading branch information...
commit e0338cfe36b5d5100cd326cccf9688c49d6ff2c0 1 parent def8074
@kornypoet kornypoet authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/swineherd/filesystem/s3filesystem.rb
View
11 lib/swineherd/filesystem/s3filesystem.rb
@@ -147,7 +147,16 @@ def cp srcpath, dstpath
end
end
- #
+ # right now this only works on single files
+ def cp_to_local srcpath, dstpath
+ src_bucket = bucket(srcpath)
+ src_key_path = key_path(srcpath)
+ dstfile = File.new(dstpath, 'w')
+ @s3.interface.get(src_bucket, src_key_path) do |chunk|
+ dstfile.write(chunk)
+ end
+ end
+
# This is a bit funny, there's actually no need to create a 'path' since
# s3 is nothing more than a glorified key-value store. When you create a
# 'file' (key) the 'path' will be created for you. All we do here is create
Please sign in to comment.
Something went wrong with that request. Please try again.