Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialise deserialise with nippy to a string #127

Closed
piotr-yuxuan opened this issue Apr 1, 2020 · 2 comments
Closed

Serialise deserialise with nippy to a string #127

piotr-yuxuan opened this issue Apr 1, 2020 · 2 comments

Comments

@piotr-yuxuan
Copy link

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
Copy link
Author

Will push a PR when I have some time.

@ptaoussanis
Copy link
Member

Just added manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants