Sha256: 0f21eda09cfcbfdf2b1b76f8248b85e82614574f21281fdf76efcd873d9442f4
Contents?: true
Size: 586 Bytes
Versions: 20
Compression:
Stored size: 586 Bytes
Contents
module Grape module ServeFile CHUNK_SIZE = 16_384 # Class helps send file through API class FileBody attr_reader :path # @param path [String] def initialize(path) @path = path end # Need for Rack::Sendfile middleware # # @return [String] def to_path path end def each File.open(path, 'rb') do |file| while (chunk = file.read(CHUNK_SIZE)) yield chunk end end end def ==(other) path == other.path end end end end
Version data entries
20 entries across 20 versions & 2 rubygems