public
Description: Pure Ruby implementation of an SFTP (protocols 1-6) client
Homepage: http://rubyforge.org/projects/net-ssh
Clone URL: git://github.com/jamis/net-sftp.git
make it even easier to download to a buffer
jamis (author)
Thu Mar 13 17:39:23 -0700 2008
commit  4fc86a65943998f86d67e5d5d7e8c9feaee883bf
tree    6d0e258a96a8471335ab19f10d0318e38192720b
parent  31d03de7ad78967376f39c429cdef6b0ed3c50f2
...
115
116
117
118
119
 
 
 
 
 
 
 
120
121
122
...
115
116
117
 
 
118
119
120
121
122
123
124
125
126
127
0
@@ -115,8 +115,13 @@ module Net; module SFTP
0
       end
0
 
0
       # Identical to #download, but blocks until the download is complete.
0
- def download!(remote, local, options={}, &block)
0
- download(remote, local, options, &block).wait
0
+ # If +local+ is omitted, downloads the file to an in-memory buffer
0
+ # and returns the result as a string; otherwise, returns the
0
+ # Net::SFTP::Operations::Download instance.
0
+ def download!(remote, local=nil, options={}, &block)
0
+ destination = local || StringIO.new
0
+ result = download(remote, destination, options, &block).wait
0
+ local ? result : destination.string
0
       end
0
 
0
       # Returns an Net::SFTP::Operations::FileFactory instance, which can be used to

Comments

    No one has commented yet.