<< Back to previous view

[DCODEC-1] Add simple utility functions for base64 conversions? Created: 11/Nov/12  Updated: 29/Mar/14

Status: Open
Project: clojure.data.codec
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Dave Sann Assignee: Alexander Taggart
Resolution: Unresolved Votes: 0
Labels: None


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

(defn bytes->b64str [bytes]
(String. (encode bytes)))

(defn str->b64str [s]
(bytes->b64str (.getBytes s)))

(defn b64str->bytes [b64-str]
(decode (.getBytes b64-str)))

(defn b64str->str [b64-str]
(String. (b64str->bytes b64-str)))

Comment by James Reeves [ 29/Mar/14 1:25 PM ]

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.

Generated at Mon Jan 22 14:47:40 CST 2018 using JIRA 4.4#649-r158309.