I'm using Ionic/Capacitor (with Angular) to retrieve image data from Android Gallery. Using Capacitor.getPhoto to retrieve image data, but the data is in Base64. Ultimate goal is to send and save image data in Blob form to a Node.js server and split the image into multiple pieces using Canvas. I'm currently able to accomplish all of this using the Base64 data from Capacitor.getPhoto. But that creates a really large image file on the Node.js server. So if I can send image data to the Node.js server in Blob form, I'm hoping it would reduce the image file size. This is what my Angular code looks like currently:
from(Camera.getPhoto({
quality: 100,
allowEditing: false,
resultType: CameraResultType.Uri
})).pipe(
concatMap((resp) => from(Filesystem.readFile({path: resp.path}))),
catchError((error) => {throw new Error(error.message)})
).subscribe({
next: (resp) => this.httpService.sendRequest(uri, resp),
error: (error) => console.log('error: ', error)
})
I'm not sure how to proceed so that the argument "resp" to httpService.sendRequest (to send data to Node.js) is data in Blob format, not Base64String format. Appreciate some guidance on this.