Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Commit

Permalink
Add inline jpeg op.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Dec 4, 2013
1 parent a712d5c commit 572903e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/nrepl/discover/samples.clj
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@
(t/send transport (m/response-for msg :content-type "image/jpeg"
:value (b64/encode (.toByteArray baos))))))

(defn ^{:nrepl/op {:name "jpeg-inline"
:args [["file" "file" "File: "]]
:doc "show a jay peg"}}
jpeg-inline-op [{:keys [transport file] :as msg}]
(let [baos (java.io.ByteArrayOutputStream.)
f (io/file file)
_ (io/copy f baos)]
(t/send transport (m/response-for msg :content-type "image/jpeg"
:content-disposition "inline"
:value (b64/encode (.toByteArray baos))))))

(defn ^{:nrepl/op {:name "text"
:doc "just some text"}}
text-op [{:keys [transport] :as msg}]
Expand Down

0 comments on commit 572903e

Please sign in to comment.