Skip to content

How to Fetch Binary Data

Terje Norderhaug edited this page Jun 5, 2019 · 4 revisions

To fetch binary data, add :response-type :array-buffer to the request options:

(get "https://clojurescript.org/images/cljs-logo-120b.png" 
     {:response-type :array-buffer})

Alternatively use :blob as response-type.

Note: Calling get with the default response-type will return a string. If the resource is binary, the resulting string will likely appear mangled, with unrecognized characters replaced by � which is the Unicode 'REPLACEMENT CHARACTER' (U+FFFD).

Clone this wiki locally