Method: Ftpd::DiskFileSystem::Read#read

Defined in:
lib/ftpd/disk_file_system.rb

#read(ftp_path) {|io| ... } ⇒ Object

Read a file from disk. Called for:

  • RETR

If missing, then these commands are not supported.

Yields:

  • (io)

    Passes an IO object to the block



133
134
135
136
137
138
139
140
# File 'lib/ftpd/disk_file_system.rb', line 133

def read(ftp_path, &block)
  io = File.open(expand_ftp_path(ftp_path), 'rb')
  begin
    yield(io)
  ensure
    io.close
  end
end