Ross Bamford
11/19/2006 7:16:00 PM
On Sun, 19 Nov 2006 10:32:01 -0000, Jonas Pfenniger <zimba.tm@gmail.com>
wrote:
> Thanks ross !
>
> Does the lib support streams of datas ?
>
It depends on what you mean. Theres still some work to do integrating with
Curl's stream handling, so for the most part the answer is "not directly"
- it's not yet at the point where you can pass in IO handles. So if you're
after streamed PUTs and so forth you're out of luck right now (especially
since PUT isn't actually supported yet, either ;)).
OTOH If you're just doing big downloads and don't want to keep it all in
memory until you're done, theres more support for that - you can supply
your own header and body handlers as needed, e.g:
File.open('some.file', 'w+') do |f|
Curl.perform('http://your/url') do |curl|
curl.on_body { |data| f << data }
end
end
Also, when doing HTTP file uploads with POST, if you supply a filename for
the post-field then the upload file won't ever get wholly read into
memory, either (libcurl takes care of the stream itself).
Cheers,
--
Ross Bamford - rosco@roscopeco.remove.co.uk