Last active
August 29, 2015 14:19
-
-
Save yurrriq/61582e7e38dc4f45dcc3 to your computer and use it in GitHub Desktop.
Write base64 image data to a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (refer-clojure :exclude [replace]) | |
| (require '[clojure.java.io :refer [output-stream]] | |
| '[clojure.string :refer [replace]]) | |
| (import '(org.apache.commons.codec.binary Base64)) | |
| (let [src "data:image/png;base64,..." | |
| data (Base64/decodeBase64 (replace src #"^data:image/\w+;base64," "")) | |
| out (output-stream "/path/to/file.png")] | |
| (.write out data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment