From: Jonas Pfenniger Date: 2006-11-20T08:18:25+09:00 Subject: Re: Curb 0.0.1 - New ruby libcurl bindings On 19/11/06, Ross Bamford wrote: > On Sun, 19 Nov 2006 10:32:01 -0000, Jonas Pfenniger > 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). Thanks Ross, this is exaclty what I was looking for. I'll try the lib later out. -- Cheers, zimbatm http://zimbatm.oree.ch