Open paymok opened 2 years ago
Manticore::Response#body accepts a block. If the block is given, then the response stream will be read in 4kb chunks and yielded to the block.
client.get("http://example.com/resource").on_success do |response|
response.body do |chunk|
# Do something with chunk, which is a parsed portion of the returned body
end
end
The actual read is performed by EntityConverter.streamEntity.
I used to use Nahi/httpClient but recently got hit by a SSL problem, hence i decided to switch to manticore. great library It solve my problems on SSL connection, but one thing i needed to do is able to stream data. In my use case i need to process a huge multipart content(> 600MB ~1GB), downloading it all to memory is not a good idea hence i used to use "get_content" in nahi/httpClient , which can process the content by chunk.
I tried to do the same in manticore but looks like i can only use the response when entire response loaded Want to know is there any function allow to handle stream data? or am i missing something?