Class | EventMachine::FileStreamer |
In: |
lib/em/streamer.rb
|
Parent: | Object |
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 |
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