I have a binary file (python pickle
file, to be exact). Whenever such a file is requested, I create one on server side, and then send it to the client via flask\'s
Weirdly enough, I was looking into this answer, which worked. So, I added :
xhrFields: {
responseType:'blob'
},
in the AJAX request, which solved the problem for me.
I have absolutely no idea, why this worked, so can someone give a better answer than this?
At MDN Docs:
The values supported by responseType are the following:
An empty responseType string is treated the same as "text", the default type.
arraybuffer
The response is a JavaScript ArrayBuffer containing binary data.
blob
The response is a Blob object containing the binary data.
...