send_file (ActionController::Streaming)

    # File lib/action_controller/streaming.rb, line 58
          def send_file(path, options = {}) #:doc:
            raise MissingFile, "Cannot read file #{path}" unless File.file?(path) and File.readable?(path)

            options[:length]   ||= File.size(path)
            options[:filename] ||= File.basename(path)
            send_file_headers! options

            @performed_render = false

            if options[:stream]
              render :status => options[:status], :text => Proc.new { |response, output|
                logger.info "Streaming file #{path}" unless logger.nil?
                len = options[:buffer_size] || 4096
                File.open(path, 'rb') do |file|
                  if output.respond_to?(:syswrite)
                    begin
                      while true
                        output.syswrite(file.sysread(len))
                      end
                    rescue EOFError
                    end
                  else
                    while buf = file.read(len)
                      output.write(buf)
                    end
                  end
                end
              }
            else
              logger.info "Sending file #{path}" unless logger.nil?
              File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }
            end
          end