     (with-open [reader (-> file io/reader PushbackReader.)]
       (edn/read reader))))
 
+(defn- read-attachments
+  [asset asset-cache-dir]
+  (if (-> asset :attachments empty?)
+    asset
+    (update-in asset [:attachments]
+               (fn [attachments]
+                 (utils/map-values
+                   attachments
+                   #(assoc % :content (io/file asset-cache-dir (:content %))))))))
+
 (def ^:private asset-file-name "asset.edn")
 (def ^:private content-file-name "content")
 

     [pprint :as pp]
     [string :as s]]
    [clojure.tools.logging :as l]
    [io.aviso.tracker :as t]))


(defn- checksum-matches?

      ;; Write the content first
      (io/copy (:content asset) content-file)
      (with-open [^Writer writer (io/writer asset-file)]
        (.write writer (-> asset
                           (write-attachments asset-cache-dir)
                           ;; The name of the content file is (currently) a fixed value,
                           ;; so we can just remove the key, rather than replace it with a file name.
                           (dissoc :content)
                           ;; Override *print-length* and *print-level* to ensure it is all written out.
                           ^String (pp/write :length nil :level nil :stream nil)))
        (.write writer "\n")))))

(defn- delete-dir-and-contents
