Class | EventMachine::FileStreamer |
In: |
lib/em/streamer.rb
|
Parent: | Object |
Streams a file over a given connection. Streaming begins once the object is instantiated. Typically FileStreamer instances are not reused.
Streaming uses buffering for files larger than 16K and uses so-called fast file reader (a C++ extension) if available (it is part of eventmachine gem itself).
@example
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
@author Francis Cianfrocca
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 |
@param [EventMachine::Connection] connection @param [String] filename File path
@option args [Boolean] :http_chunks (false) Use HTTP 1.1 style chunked-encoding semantics.