Fork me on GitHub
#re-frame
<
2019-01-25
>
samedhi16:01:44

I am having trouble converting the result of a http-xhrio GET string response (using (ajax/text-response-format)) into a Blob object... Does anyone have any familiarity with this? https://gist.github.com/samedhi/aa0ad9d25c138d10e2156b0fdfe4c20b

samedhi16:01:05

Think the real issue is that when I take the binary string binary and attempt to convert it into a js/Blob I am getting some sort of conversion issue.

samedhi16:01:46

(js/Blob. #js [binary] ;; binary is the response returned from :http-xhrio
          #js {"type" "application/octet-stream"
               "ending" "transparent"})
;; Note: binary is of (.length) 121k
;; Blob is of (.size) 225k
;; Expected file is size is 127k
;; ... something must be wrong.... :/

valtteri19:01:33

@samedhi you probably need to override :read and :type keys in :response-format. This is how I got it working: https://github.com/lipas-liikuntapaikat/lipas/blob/master/webapp/src/cljs/lipas/ui/reports/events.cljs#L20-L43

samedhi22:01:24

@valtteri Thanks you! That did it.

samedhi22:01:53

(Just replaced the response format with your :type and :read)

👌 5