class EventMachine::FileStreamer

def initialize connection, filename, args = {}

Options Hash: (**args)
  • :http_chunks (Boolean) -- Use HTTP 1.1 style chunked-encoding semantics.

Parameters:
  • filename (String) -- File path
  • connection (EventMachine::Connection) --
def initialize connection, filename, args = {}
  @connection = connection
  @http_chunks = args[:http_chunks]
  if File.exist?(filename)
    @size = File.size(filename)
    if @size <= MappingThreshold
      stream_without_mapping filename
    else
      stream_with_mapping filename
    end
  else
    fail "file not found"
  end
end