class Grape::ServeStream::FileBody
Class helps send file through API
Attributes
Public Class Methods
Source
# File lib/grape/serve_stream/file_body.rb, line 12 def initialize(path) @path = path end
@param path [String]
Public Instance Methods
Source
# File lib/grape/serve_stream/file_body.rb, line 31 def ==(other) path == other.path end
Source
# File lib/grape/serve_stream/file_body.rb, line 23 def each File.open(path, 'rb') do |file| while (chunk = file.read(CHUNK_SIZE)) yield chunk end end end
Source
# File lib/grape/serve_stream/file_body.rb, line 19 def to_path path end
Need for Rack::Sendfile middleware
@return [String]