mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-08 05:27:35 +02:00
Adding http-get-to-file utility.
This commit is contained in:
parent
a21e391f15
commit
e88374275d
2 changed files with 11 additions and 1 deletions
|
@ -264,6 +264,16 @@
|
||||||
(close-input-port p)
|
(close-input-port p)
|
||||||
res)))
|
res)))
|
||||||
|
|
||||||
|
(define (http-get-to-file url path)
|
||||||
|
(call-with-input-url url
|
||||||
|
(lambda (in)
|
||||||
|
(let ((out (open-binary-output-file path)))
|
||||||
|
(let lp ()
|
||||||
|
(let ((c (read-u8 in)))
|
||||||
|
(cond ((not (eof-object? c))
|
||||||
|
(write-u8 c out)
|
||||||
|
(lp)))))))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; server utils
|
;; server utils
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
(define-library (chibi net http)
|
(define-library (chibi net http)
|
||||||
(export http-get http-get/headers
|
(export http-get http-get/headers http-get-to-file
|
||||||
http-head http-post http-put http-delete
|
http-head http-post http-put http-delete
|
||||||
call-with-input-url call-with-input-url/headers
|
call-with-input-url call-with-input-url/headers
|
||||||
with-input-from-url
|
with-input-from-url
|
||||||
|
|
Loading…
Add table
Reference in a new issue