unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Downloading a file from a URL from the web with http-get
@ 2014-08-04  8:12 白熊
  2014-08-04 16:57 ` Dmitry Bogatov
  0 siblings, 1 reply; 8+ messages in thread
From: 白熊 @ 2014-08-04  8:12 UTC (permalink / raw)
  To: guile-user

Hello everybody:

I'm learning Guile. I'd like to write a utility, which will enable me upon user input download program sources from the web, i.e. not a web-spider, but download discrete URL's and save them to disk.

I've looked at:

http://lists.gnu.org/archive/html/guile-user/2012-04/msg00032.html
http://lists.gnu.org/archive/html/guile-user/2012-05/msg00005.html

so the possibility to do, seems to be there.

Specifically, let's say, I want to download:

http://ftp.gnu.org/pub/gnu/guile/guile-2.0.11.tar.xz

and save it to ~/

How should I modify the following code to do this?:

(use-modules ((web uri)    #:select (string->uri))
               ((web client) #:select (http-get)))
  (call-with-values (lambda ()
                      (http-get
                       (string->uri "http://www.gnu.org/software/guile/")))
    (lambda (res-headers res-body)
      (display res-body)
      (newline)))

i.e. not display the body, but save it to file? Or is the above only applicable to text responses - webpages, and not for binary files?

Thanks very much for any help.
--
白熊



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-16 14:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-04  8:12 Downloading a file from a URL from the web with http-get 白熊
2014-08-04 16:57 ` Dmitry Bogatov
2014-08-04 23:56   ` 白熊
2014-08-05  7:45     ` Dmitry Bogatov
2014-08-15 17:59   ` 白熊
2014-08-15 20:46     ` Mike Gran
2014-08-15 20:56       ` Mario Domenech Goulart
2014-08-16 14:41         ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).