This is something I wrote for downloading a URL to a file using dexador.
(defvar *proxy* nil
"Optional HTTP Proxy")
(defun dl (url &key (dir "./"))
"Download url to dir.
dir defaults to './' and if specified, must end in '/'."
(let* ((uri (uri url))
(path (uri-path uri))
(filename (format nil "~a.~a"
(pathname-name path)
(pathname-type path)))
(destination (format nil "~a/~a" dir filename))
(res (dex:get url :proxy *proxy*)))
(ensure-directories-exist dir)
(with-open-file (stream destination
:direction :output
:element-type '(unsigned-byte 8)
:if-exists :supersede
:if-does-not-exist :create)
(write-sequence res stream))
url))
It mostly works, but it seems to flake out when I run it with high concurrency (via lparallel). I'm not sure why.