Serialise deserialise with nippy to a string
piotr-yuxuan opened this issue · 2 comments
piotr-yuxuan commented
Thank you for this library. Indeed it's quite fast! I believe it might be worth add in the readme an example of how to serialise and then deserialise to a string. The naive approach is to use slurp
on the byte[]
array returned by nippy. This doesn't work.
(defn nippy-serialise-to-string
^String [o]
(.encodeToString (java.util.Base64/getEncoder) (nippy/freeze o {})))
(defn nippy-deserialise-from-string
^Object [^String s]
(nippy/thaw (.decode (java.util.Base64/getDecoder) s)))
piotr-yuxuan commented
Will push a PR when I have some time.
ptaoussanis commented
Just added manually.