Welcome! Please see the About page for a little more info on how this works.

0 votes
in data.codec by

Can we add (something like) the following simple utility functions for base64 encoding/decoding ?

(defn bytes->b64str (link: bytes)
(String. (encode bytes)))

(defn str->b64str (link: s)
(bytes->b64str (.getBytes s)))

(defn b64str->bytes (link: b64-str)
(decode (.getBytes b64-str)))

(defn b64str->str (link: b64-str)
(String. (b64str->bytes b64-str)))

2 Answers

0 votes
by

Comment made by: jreeves

Encoding strings might be a little edge-case, but I can certainly see a benefit to having encode-string and decode-string, or encode-str and decode-str.

0 votes
by
Reference: https://clojure.atlassian.net/browse/DCODEC-1 (reported by davesann)
...