class Net::SFTP::Operations::FileFactory

the IO class’ interface.
provide an interface where calls will block until they return, mimicking
describes the behavior of the program, this class (and Operations::File)
on the programmer to provide callbacks that define a state machine that
class for use when working with files synchronously. Rather than relying
that wrap the SFTP handles that represent them. This is a convenience
A factory class for opening files and returning Operations::File instances

def directory?(path)

Returns +true+ if the argument refers to a directory on the remote host.
def directory?(path)
  sftp.lstat!(path).directory?
end

def initialize(sftp)

Create a new instance on top of the given SFTP session instance.
def initialize(sftp)
  @sftp = sftp
end

def open(name, flags="r", mode=nil, &block)

end
# ...
sftp.file.open("/tmp/names.txt", "w") do |f|

close the file.
the object will be returned, and it is the caller's responsibility to
to it, and closed automatically when the block terminates. Otherwise
If a block is given, the new Operations::File instance will be yielded

if a new file is being created.
+mode+ parameter must be an integer describing the permissions to use
accepts the same values as the standard Ruby ::File#open method. The
Attempt to open a file on the remote server. The +flags+ parameter

open(name, flags="r", mode=nil) { |file| ... }
open(name, flags="r", mode=nil) -> file
:call-seq:
def open(name, flags="r", mode=nil, &block)
  handle = sftp.open!(name, flags, :permissions => mode)
  file = Operations::File.new(sftp, handle)
  if block_given?
    begin
      yield file
    ensure
      file.close
    end
  else
    return file
  end
end