(let ((stream (flexi-streams:make-in-memory-input-stream (map 'vector #'char-code '(#\f #\o #\o #\b #\a #\r #\newline))))) (with-open-file (out "foo" :direction :output :element-type '(unsigned-byte 8)) (loop :with byte :while (setf byte (read-byte stream nil)) :do (write-byte byte out))))