I'm using sinatra and transloadit and sending files with xhr using valumns file uploader.
I need to create a IO object and fill it with data in request.body.read
How can I do that ? 开发者_如何学Gothank you.
Use StringIO
:
require 'stringio'
StringIO.new(request.body.read)
Alternatively, can't you just pass request.body
for your IO object?
Just use request.body
, call request.body.rewind
first.
精彩评论