Class EventMachine::FileStreamer
In: lib/em/streamer.rb
Parent: Object

Methods

Included Modules

Deferrable

Constants

MappingThreshold = 16384   Use mapped streamer for files bigger than 16k
BackpressureLevel = 50000   Wait until next tick to send more data when 50k is still in the outgoing buffer
ChunkSize = 16384   Send 16k chunks at a time

Public Class methods

Stream a file over a given connection. An optional :http_chunks => true argument will use HTTP 1.1 style chunked-encoding semantics.

 module FileSender
   def post_init
     streamer = EventMachine::FileStreamer.new(self, '/tmp/bigfile.tar')
     streamer.callback{
       # file was sent successfully
       close_connection_after_writing
     }
   end
 end

Public Instance methods

Used internally to stream one chunk at a time over multiple reactor ticks

[Validate]