Skip to content

Instantly share code, notes, and snippets.

@dimovich
Created September 6, 2019 20:31
Show Gist options
  • Save dimovich/fbe13022a88e4b4ff8f12e3a1c023a26 to your computer and use it in GitHub Desktop.
Save dimovich/fbe13022a88e4b4ff8f12e3a1c023a26 to your computer and use it in GitHub Desktop.
;; using
;; https://github.com/dimovich/fressian-handlers/blob/caching/src/fressian/handlers.clj
(require '[fressian.handlers :as fh]
'[clojure.data.fressian :as fres]
'[clojure.core.async :as async]
'[clojure.java.io :as io])
(def ch (async/chan))
(async/go
(with-open [out (io/output-stream "test.fress")]
(with-open [wrt (fres/create-writer out :handlers (fh/get-write-handler-lookup))]
(loop []
(when-let [v (async/<! ch)]
(fres/write-object wrt v)
(recur))))))
(async/>!! ch [1 2 3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment