Hi, I have a Kotlin `ByteArray` that contains the ...
# javascript
c
Hi, I have a Kotlin
ByteArray
that contains the binary data of an image (
image/png
). I'm trying to display that image to the user. So far I have:
Copy code
val blob = Blob(arrayOf(data), BlobPropertyBag(
    type = "image/png",
))
val url = URL.createObjectURL(blob)
window.open(url, target = "_blank", features = "noopener,noreferrer")
However, running the code opens a tab with a small grey square, no matter the original image. I think the blob conversion is the culprit, but I'm honestly not sure. Because
Blob
takes an
Array<dynamic>
, I have no meaningful way of knowing what's wrong with it.
t
Open in tab - final goal?
c
I'm trying to display the file to the user, i might want to display a thumbnail as well, but yeah it won't go much further than that
108 Views