-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
contentIssues related to the contents of the documentation websiteIssues related to the contents of the documentation website
Description
URL
Issue Description
What is missing or inaccurate about the content on this page?
Missing : fileName
Description : path: photo.path generating error as Type 'string | undefined' is not assignable to type 'string'.
Modified Code :
private async readAsBase64(photo: Photo) {
// "hybrid" will detect Cordova or Capacitor
const fileName = new Date().getTime() + '.jpeg';
if (this.platform.is('hybrid')) {
// Read the file into base64 format
const file = await Filesystem.readFile({
path: fileName
});
return file.data;
}
else {
// Fetch the photo, read as a blob, then convert to base64 format
const response = await fetch(photo.webPath!);
const blob = await response.blob();
return await this.convertBlobToBase64(blob) as string;
}
}
Metadata
Metadata
Assignees
Labels
contentIssues related to the contents of the documentation websiteIssues related to the contents of the documentation website