lib/browse_everything/retriever.rb
# Retrieve the file from the file system
# @param options [Hash]
Retrieve the file from the file system
Retrieve the file from the file system
def retrieve_file(options)
      file_uri = options.fetch(:url)
      file_size = options.fetch(:file_size)
      retrieved = 0
      File.open(file_uri.path, 'rb') do |f|
        until f.eof?
          chunk = f.read(chunk_size)
          retrieved += chunk.length
          yield(chunk, retrieved, file_size)
        end
      end
    end
def retrieve_file ( options ) file_uri = options . fetch ( :url ) file_size = options . fetch ( :file_size ) retrieved = 0 File . open ( file_uri . path , 'rb' ) do | f | until f . eof? chunk = f . read ( chunk_size ) retrieved += chunk . length yield ( chunk , retrieved , file_size ) end end end
Retrieve the file from the file system
Retrieve the file from the file system
options
None