Last active
November 28, 2016 02:00
-
-
Save KeenS/8cf06002a9bb7f0ebeed08a549e0e346 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun read-file-into-string (file &key (buf-size 2048)) | |
(with-output-to-string (s) | |
(with-open-file (f file) | |
(let ((buf (make-array 2048 :element-type 'base-char))) | |
(loop | |
:for size := (read-sequence buf f) | |
:while (= size buf-size) | |
:do (write-sequence buf s) | |
:finally | |
(write-sequence buf s :end size)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment