From 4e8b2306e783417047b97f0c6fdf8f080f90d20d Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Sat, 26 Jun 2021 14:26:15 -0600 Subject: Function to support email attachments --- src/file.lisp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/file.lisp b/src/file.lisp index 177d375..7dfe480 100644 --- a/src/file.lisp +++ b/src/file.lisp @@ -54,6 +54,15 @@ line at a time." (loop for ,line = (read-line ,stream nil nil) while ,line do ,@body)))) +(defun read-whole-file (filename) + (with-open-file (stream filename) + (let ((contents (make-string (file-length stream)))) + (read-sequence contents stream) + contents))) + +(defun get-mime-type (filename) + (car (org-ckons-core::shell-wrapper (format nil "file --mime-type ~a | awk -F': ' '{print $2}'" filename)))) + (defun mkdir (path) (org-ckons-core::shell-wrapper (format nil "mkdir -p ~a" path))) -- cgit v1.3