[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Downloading a file from a URL from the web with http-get
From: |
白熊 |
Subject: |
Downloading a file from a URL from the web with http-get |
Date: |
Mon, 04 Aug 2014 12:12:03 +0400 |
User-agent: |
K-9 Mail for Android |
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.
--
白熊
- Downloading a file from a URL from the web with http-get,
白熊 <=