I am currently working on a code snippet that extracts image strings and encodes them as Blob objects.
const reqOptions: any = {
method: 'get',
responseType: 'blob',
headers: {
accept: 'image/*'
}
}
ionresp = await this.ionicHttp.sendRequest(url, reqOptions)
After logging the Blob object, I noticed it has the following details:
Blob {size: 15312, type: ""}
I actually need the Blob to have a type of image/png
. However, I am facing some challenges in converting or manipulating the data to achieve the desired Blob type.
When attempting to retrieve the data using ionicHttp.get()
and manually convert it into a Blob, the ionresp
ends up being an empty Blob.
resp.Data = new Blob([ionresp], {type: type})