This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-03
Channels
- # beginners (7)
- # calva (25)
- # clerk (2)
- # clj-kondo (5)
- # clojure (42)
- # clojure-brasil (1)
- # clojure-europe (10)
- # clojure-nl (1)
- # clojure-norway (14)
- # clojure-uk (3)
- # conjure (6)
- # datahike (4)
- # datomic (3)
- # etaoin (4)
- # fulcro (6)
- # graalvm (7)
- # hoplon (9)
- # hyperfiddle (6)
- # introduce-yourself (2)
- # london-clojurians (1)
- # off-topic (22)
- # pedestal (5)
- # portal (12)
- # proletarian (1)
- # releases (1)
- # shadow-cljs (9)
- # vim (9)
hey, i'm using standard clojure logging when populating logs to file with logstash, it does not remove Keywords,
;; logging
[ch.qos.logback/logback-classic "1.2.11"]
[net.logstash.logback/logstash-logback-encoder "7.2"]
[org.clojure/tools.logging "1.2.4"]
[ring-logger "1.1.1"]
=>
{"@timestamp":"2023-04-03T13:54:04.939+03:00",
"message":"{:price 253.17, :api XXXX, :appCompletePercentage 0, :appStatus 100}}
is there a way to remove keywords without touching any code /etc? some library or Clojure encoder
the desired outcome would be json-string without keywords,hey friends, I’m trying to request an image from azure blob, with this code
(defn get-blob
[sas-token storage-account container blob-name]
(let [request-url (str "https://" storage-account ". " container "/" blob-name sas-token)
resp (http/get request-url)]
(when (= (:status resp) 200)
(let [image-str (:body resp)]
(prn "image-str type: " (type image-str))
image-str))))
I’m getting a string as body "image-str type: " java.lang.String
and the response is something like this:
"����JFIF����C\t\b\b\t\r\r\r\r\f\f\f\f��C
\f��\b��\"���\b\t
}!1AQa\"q2���\b#B��R��$3br�\t
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������\b\t
w!1AQaq\"2�\bB����\t#3R�br�..."
how can I take this string and save it as an image file? I know what’s the type of image from the blob-name
Since image data is not character data, you'll want to get the response as something other than a string. Here's an example using an input stream:
(require '[ :as io])
(let [resp (http/get request-url
{:as :stream})]
(with-open [input-stream (:body resp)
output-stream (io/output-stream "my-image.png")]
(io/copy input-stream output-stream)))
(assuming you're using clj-http
)
Yes, I’m using clj-http
. Let me try your snippet