DOM API requires Blob
but all I have is Array[Byte]
. How can I do the conversion?
import org.scalajs.dom.Blob
def toBlob(input: Array[Byte]): Blob = {
// code in question
}
This worked for me (not sure about js.Array
though).
import org.scalajs.dom.Blob
import scala.scalajs.js
import scalajs.js.typedarray.AB2TA
def toBlob(input: Array[Byte]): Blob = {
new Blob(js.Array(input.toTypedArray))
}