(vicare posix curl) exports a simple API to
download files through the external program
library is a demonstration of the basic mechanism needed to execute an
external program and read data from its standard output and standard
The source distribution of Vicare includes a simple demo program demo-curl.sps in the tests subdirectory of the source tree.
The executable file
curl must be reachable in the current
curl is always with the command line:
curl --silent --show-error
the ASCII text displayed on the standard output and standard error is captured for diagnostic. Additional options can be appended to the command line.
Download a file spawning a subprocess that launches
url must be a string representing the URL in ASCII
encoding. Each option must be a string representing a
curl command line argument. When successful: return two
strings representing the output of
curl to, respectively,
standard output and standard error; otherwise raise an exception.
#!r6rs (import (vicare) (vicare posix curl)) (define (get-it url) (receive (out err) (curl url) (display out) (newline) (display err) (newline) (flush-output-port (current-output-port)))) (get-it "http://marcomaggi.github.io/index.html")