Get Content-type from an arraybuffer


#1

from a webserver I get this :

ArrayBuffer(519751) {}
[[Int8Array]]
:
Int8Array(519751) [-119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 4, -95, 0, 0, 3, -93, 8, 2, 0, 0, 0, -20, -54, -128, -11, 0, 0, 0, 6, 98, 75, 71, 68, 0, -1, 0, -1, 0, -1, -96, -67, -89, -109, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, 19, 0, 0, 11, 19, 1, 0, -102, -100, 24, 0, 0, 0, 7, 116, 73, 77, 69, 7, -31, 11, 9, 13, 33, 42, 68, -24, 83, 122, 0, 0, 32, 0, 73, 68, 65, 84, 120, …]
[[Uint8Array]]
:
Uint8Array(519751) [137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 4, 161, 0, 0, 3, 163, 8, 2, 0, 0, 0, 236, 202, 128, 245, 0, 0, 0, 6, 98, 75, 71, 68, 0, 255, 0, 255, 0, 255, 160, 189, 167, 147, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, 19, 0, 0, 11, 19, 1, 0, 154, 156, 24, 0, 0, 0, 7, 116, 73, 77, 69, 7, 225, 11, 9, 13, 33, 42, 68, 232, 83, 122, 0, 0, 32, 0, 73, 68, 65, 84, 120, …]
byteLength
:
(…)
proto
:
Arrayruffer

sorry for the syntax, just copied it from chrome dev.

My question is how to get the filetype out of this so I can convert this to a link like this:
someIcon.png
and when a user clicks on it it will start to download and in best case open directly.

But for those things to work I will need the file-type, MIME-type or content-type which I think are all the same thing. (correct me if I’m wrong)
But I don’t see any way to get this out of those arrays…

Please some help or advice :slight_smile: