File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,20 +4,30 @@ connections. Options include retrying your commands on flakey FTP servers, and
44forced timeouts. FTP Secure (FTPS) is also supported.
55
66## Usage
7+ # Without NiFTP:
8+ begin
9+ client = Net::FTP.new("localhost")
10+ client.list
11+ ensure
12+ client.try(:close)
13+ end
14+
15+ # With NiFTP:
16+ ftp("localhost") { |client| client.list }
17+
18+ # A more concrete example:
719
820 # Mixin the +NiFTP+ module, which provides the +ftp+ method.
921 class SomeObject
1022 include NiFTP
1123
1224 def ftp_stuff
13- # put a file using no username, password or other options
14- ftp("localhost") { |client| client.put("some_file.txt") }
15-
16- # get a file on an FTP Secure (FTPS) server
25+ # get a file from an FTP Secure (FTPS) server
1726 ftp("ftp.secure.com", { username: "some_user", password: "FTP_FTL",
18- ftps: true }) do |client|
19- client.resume = true
20- file = client.get("some_file.txt")
27+ ftps: true }) do |client|
28+ files = client.list('n*')
29+ # ...
30+ file = client.getbinaryfile('nif.rb-0.91.gz', 'nif.gz', 1024)
2131 # ...
2232 end
2333 end
You can’t perform that action at this time.
0 commit comments