class Egnyte::File

Public Class Methods

find(session, path) click to toggle source
# File lib/egnyte/file.rb, line 21
def self.find(session, path)
  path = Egnyte::Helper.normalize_path(path)

  file = File.new({
    'path' => path
  }, session)
  
  parsed_body = session.get("#{file.fs_path}#{URI.escape(path)}")

  raise FileExpected if parsed_body['is_folder']

  file.update_data(parsed_body)
end

Public Instance Methods

delete() click to toggle source
# File lib/egnyte/file.rb, line 17
def delete
  @session.delete("#{fs_path}/#{URI.escape(path)}")
end
download() click to toggle source
# File lib/egnyte/file.rb, line 4
def download
  stream.read
end
stream( opts={} ) click to toggle source

use opts to provide lambdas to track the streaming download:

:content_length_proc :progress_proc

# File lib/egnyte/file.rb, line 13
def stream( opts={} )
  @session.streaming_download( "#{fs_path('fs-content')}/#{URI.escape(path)}", opts )
end