class ICFS::Web::FileResp

A file response object to use in Rack

Constants

ChunkSize

Chunk size of 64 kB

Public Class Methods

new(file) click to toggle source

New response

# File lib/icfs/web/client.rb, line 4809
def initialize(file)
  @file = file
end

Public Instance Methods

close() click to toggle source

Close the file

# File lib/icfs/web/client.rb, line 4832
def close
  if @file.respond_to?(:close!)
    @file.close!
  else
    @file.close
  end
end
each() { |str| ... } click to toggle source

Provide body of the file in chunks

# File lib/icfs/web/client.rb, line 4822
def each
  while str = @file.read(ChunkSize)
    yield str
  end
end