Method: Async::HTTP::Body::File#read

Defined in:
lib/async/http/body/file.rb

#readObject



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/async/http/body/file.rb', line 64

def read
  if @remaining > 0
    amount = [@remaining, @block_size].min
    
    if chunk = @file.read(amount)
      @remaining -= chunk.bytesize
      
      return chunk
    else
      @file.close
    end
  end
end