Say I have a Sinatra route ala:
put '/data' do
request.body.read
# ...
end
It appears that the entire request.body is read into memory. Is there a way to consume the body as it comes into the system, rather than having it all buffered in Rack/Sinatra beforehand?
I see I can do this to read the body in parts, but the entire body still seems to be read into memory beforehand.
put '/data' do
while request.body.read(1024) != nil
# ...
end
# ...
end