The solution was that I forgot to use two optional read-byte parameters.
The correct way is to set eof-error-p and eof-value to nil :
(with-open-file (file "/home/*/test.pdf" :direction :output :if-does-not-exist :create :if-exists :supersede :element-type '(unsigned-byte 8)) (let ((input (drakma:http-request "http://www.fractalconcept.com/ex.pdf" :want-stream t))) (awhile (read-byte input nil nil) (write-byte it file)) (close input)))
source share