                                                                        (. chunk -buffer)
                                                                        (js/Buffer.concat #js [old (. chunk -buffer)]))))))
         (.on rs "close" #(let [ws    (.createWriteStream fs temp-file)
-                               value (up-fn data-buffer)
-                               old   (fress/read (:buffer @data-buffer))]
+                               old   (-deserialize serializer read-handlers (:buffer @data-buffer))
+                               value (up-fn old)
+                               buf   (fress/byte-stream)]
                            (.on ws "finish" (fn [_]
                                               (.renameSync fs temp-file new-file)
                                               (put! res-ch [old value])

                        res-ch))
  PBinaryAsyncKeyValueStore
  (-bget [this key locked-cb] (read-binary folder key locked-cb))
  (-bassoc [this key input] (do (write-edn-key folder {:key [key] :format :binary})
                                (write-binary folder key input))))

(defn new-fs-store
  "Filestore contains a Key and a Data Folder"
  [path & {:keys  [read-handlers write-handlers serializer config]
           :or    {read-handlers  (atom {})
                   write-handlers (atom {})
                   serializer     (ser/string-serializer)
                   config {:fsync true}}}]
  (println "creating store")
  (let [_         (check-and-create-folder path)
        _         (check-and-create-folder (str path "/meta"))
        _         (check-and-create-folder (str path "/data"))]
    (println "creating system")
    (go (map->FileSystemNodejsStore {:folder         path
                                     :serializer     serializer

      (catch js/Object err
        (println err)))))

(defn write-edn-key [serializer write-handlers folder {:keys [key] :as meta}]
  (let [key       (uuid (first key))
        temp-file (str folder "/meta/" key ".new")
        new-file  (str folder "/meta/" key)
        fd        (.openSync fs new-file "w+")
        _         (.closeSync fs fd)
        ws        (.createWriteStream fs temp-file)
        res-ch    (chan)
        buf       (fress/byte-stream)]
    (.on ws "close" #(try (.renameSync fs temp-file new-file)
                          (catch js/Object err
                            (put! res-ch (ex-info "Could not write edn key."
