Reading body stream in Sinatra
问题 I'm trying to upload a file with XHR request using PUT method with Sinatra. My first idea was to upload the file and writing the stream directly into a MongoDB GridFS @fs.open("test.iso", "w") do |f| f.write request.body.read end It works, but, it loads the entire file into the RAM and it write it into the MongoDB GridFS. I'd like to avoid this behavior by writing it continuously to the GridFS (stream the file, not loading it and put it in the GridFS) without loading the entire file into the