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
expand the synopsis a bit in the docs
jamis (author)
Thu Mar 13 17:38:57 -0700 2008
commit  31d03de7ad78967376f39c429cdef6b0ed3c50f2
tree    0c80aae2e8fb76b55c360a29a6bb4a35d29671d6
parent  0bc119fdc8578e9cb99150e17f436103152232ae
...
17
18
19
20
 
 
 
 
 
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
23
24
...
17
18
19
 
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
0
@@ -17,8 +17,28 @@ Net::SFTP is a pure-Ruby implementation of the SFTP protocol (specifically, vers
0
 
0
   require 'net/sftp'
0
 
0
- Net::SFTP.start('host', 'username', 'password') do |sftp|
0
+ Net::SFTP.start('host', 'username', :password => 'password') do |sftp|
0
+ # upload a file or directory to the remote host
0
+ sftp.upload!("/path/to/local", "/path/to/remote")
0
+
0
+ # download a file or directory from the remote host
0
     sftp.download!("/path/to/remote", "/path/to/local")
0
+
0
+ # grab data off the remote host directly to a buffer
0
+ data = sftp.download!("/path/to/remote")
0
+
0
+ # open and write to a pseudo-IO for a remote file
0
+ sftp.file.open("/path/to/remote", "w") do |f|
0
+ f.puts "Hello, world!\n"
0
+ end
0
+
0
+ # open and read from a pseudo-IO for a remote file
0
+ sftp.file.open("/path/to/remote", "r") do |f|
0
+ puts f.gets
0
+ end
0
+
0
+ # create a directory
0
+ sftp.mkdir! "/path/to/directory"
0
   end
0
 
0
 == REQUIREMENTS:

Comments

    No one has commented yet.