Similar to HTTP::Client (search keyword "Streaming") but Halite returns a Halite::Response object:
Halite.get "http://httpbin.org/stream/3" do |response|
puts response.status_code
while line = response.body_io.gets
puts line
puts "*" * 10
end
end
Use streaming requests we can store binary data chunk by chunk:
Halite.get("https://github.com/icyleaf/halite/archive/master.zip") do |response|
filename = response.filename || "halite-master.zip"
File.open(filename, "w") do |file|
IO.copy(response.body_io, file)
end
end
Similar to HTTP::Client (search keyword "Streaming") but Halite returns a
Halite::Response
object:Use streaming requests we can store binary data chunk by chunk:
Relates #49