# File lib/uri/open-sftp.rb, line 29 def direct_open( buf, open_options ) Net::SFTP.start( host, port, user, password, options ) do |sftp| if open_options[:content_length_proc] open_options[:content_length_proc].call( sftp.lstat( path ).size ) end body = nil sftp.open_handle( path ) do |handle| body = sftp.read( handle, :chunk_size => open_options[:chunk_size], :progress_callback => open_options[:progress_proc] ) end if body.nil? raise Net::SSH::SFTP::SFTPError, sftp.status[:message] end buf << body buf.io.rewind end end