On Tue, Aug 25, 2009 at 5:51 PM, Michael Kohl<[email protected]> wrote:
> The main problem is that I can't
> seem to figure out how to use duck-streams to achieve what I want...

#clojure for the rescue. replaca pointed me to the documentation of
clojure.contrib.http.agent which has a nice example for what I wanted
to do. Here's the solution:

(defn fetch-enclosures [urls]
        "Fetches the files provided in an URL list"
        (doseq [url urls]
                (let [[name] (re-find #"(\w|[-.])+$" url)]
                (http-agent url
                        :handler (fn [agnt] (with-open [w (writer name)]
                                (copy (stream agnt) w)))))))

Thanks,
Michael

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to