diff options
Diffstat (limited to 'src/file.lisp')
| -rw-r--r-- | src/file.lisp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/file.lisp b/src/file.lisp index 363cd08..8f0a389 100644 --- a/src/file.lisp +++ b/src/file.lisp @@ -70,6 +70,12 @@ line at a time." (format stream pattern byte)))) (string-downcase hex))) +(defun file-as-base64 (filename) + (let ((bytes (make-array '(0) :element-type '(unsigned-byte 8) :fill-pointer 0 :adjustable t))) + (loop for byte in (file-as-bytes filename) + do (vector-push-extend byte bytes)) + (cl-base64:usb8-array-to-base64-string bytes))) + (defun get-mime-type (filename) (car (org-ckons-core::shell-wrapper (format nil "file --mime-type ~a | awk -F': ' '{print $2}'" filename)))) |
