send_file ========= File sending for Rack applications. Usage ----- Make sure your application implements two methods: `env` and `halt`, where `env` returns a hash with the Rack environment and `halt` returns an array response like `[status, headers, [body]]`. ### Using [Cuba][cuba] ```ruby require "cuba" require "send_file" Cuba.plugin(SendFile) Cuba.define do on "foo" do send_file("foo.pdf") end end ``` ### Using [Hobbit][hobbit] ```ruby require "hobbit" require "send_file" class App < Hobbit::Base include Sendfile get "/foo" do send_file("foo.pdf") end end ``` Attachments ----------- For attachments, it's recommended to use the HTML5 [download][download] attribute. ```html Download foo.pdf ``` You can specify a filename too: ```html Download bar.pdf ``` Installation ------------ ``` $ gem install send_file ``` [cuba]: https://github.com/soveran/cuba [hobbit]: https://github.com/patriciomacadden/hobbit [download]: http://davidwalsh.name/download-attribute