0

I am trying to read my ajax response as a blob. The response is present, and can be read with

:response-format ajax.edn/edn-read

for example, but it is in fact an image and I need it as a blob to serve as an <img src='' url. (created with createObjectURL)

I'm not finding an example anywhere, I guess it should be something in the line of :

:response-format {:content-type: "image/jpeg" :read :body :type :blob}

but that's not working...

Peter
  • 47,963
  • 46
  • 132
  • 181

1 Answers1

1

You probably have to put it that way:

(ns browser
  (:require
[ajax.protocols :refer [-body]]


...

:response-format {:content-type "image/png"
                  :type :blob
                  :description "PNG file"
                  :read -body}
akond
  • 15,865
  • 4
  • 35
  • 55