Skip to content

Commit 98c520d

Browse files
committed
docs(vue): use readFile
1 parent ee3d5e6 commit 98c520d

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

docs/vue/your-first-app/4-loading-photos.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ export const usePhotoGallery = () => {
103103

104104
// CHANGE: Display the photo by reading into base64 format
105105
for (const photo of photosInPreferences) {
106-
const file = await Filesystem.file({
106+
const readFile = await Filesystem.file({
107107
path: photo.filepath,
108108
directory: Directory.Data,
109109
});
110-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
110+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
111111
}
112112

113113
photos.value = photosInPreferences;
@@ -192,11 +192,11 @@ export const usePhotoGallery = () => {
192192
const photosInPreferences = photoList.value ? JSON.parse(photoList.value) : [];
193193

194194
for (const photo of photosInPreferences) {
195-
const file = await Filesystem.readFile({
195+
const readFile = await Filesystem.readFile({
196196
path: photo.filepath,
197197
directory: Directory.Data,
198198
});
199-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
199+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
200200
}
201201

202202
photos.value = photosInPreferences;
@@ -288,11 +288,11 @@ export const usePhotoGallery = () => {
288288
const photosInPreferences = photoList.value ? JSON.parse(photoList.value) : [];
289289

290290
for (const photo of photosInPreferences) {
291-
const file = await Filesystem.file({
291+
const readFile = await Filesystem.readFile({
292292
path: photo.filepath,
293293
directory: Directory.Data,
294294
});
295-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
295+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
296296
}
297297

298298
photos.value = photosInPreferences;

docs/vue/your-first-app/5-adding-mobile.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ const savePicture = async (photo: Photo, fileName: string): Promise<UserPhoto> =
4747
// CHANGE: Add platform check
4848
// "hybrid" will detect mobile - iOS or Android
4949
if (isPlatform('hybrid')) {
50-
const file = await Filesystem.readFile({
50+
const readFile = await Filesystem.readFile({
5151
path: photo.path!,
5252
});
53-
base64Data = file.data;
53+
base64Data = readFile.data;
5454
} else {
5555
// Fetch the photo, read as a blob, then convert to base64 format
5656
const response = await fetch(photo.webPath!);
@@ -89,10 +89,10 @@ const savePicture = async (photo: Photo, fileName: string): Promise<UserPhoto> =
8989
// CHANGE: Add platform check
9090
// "hybrid" will detect mobile - iOS or Android
9191
if (isPlatform('hybrid')) {
92-
const file = await Filesystem.readFile({
92+
const readFile = await Filesystem.readFile({
9393
path: photo.path!,
9494
});
95-
base64Data = file.data;
95+
base64Data = readFile.data;
9696
} else {
9797
// Fetch the photo, read as a blob, then convert to base64 format
9898
const response = await fetch(photo.webPath!);
@@ -136,12 +136,12 @@ const loadSaved = async () => {
136136
// If running on the web...
137137
if (!isPlatform('hybrid')) {
138138
for (const photo of photosInPreferences) {
139-
const file = await Filesystem.readFile({
139+
const readFile = await Filesystem.readFile({
140140
path: photo.filepath,
141141
directory: Directory.Data,
142142
});
143143
// Web platform only: Load the photo as base64 data
144-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
144+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
145145
}
146146
}
147147

@@ -185,10 +185,10 @@ export const usePhotoGallery = () => {
185185
let base64Data: string | Blob;
186186
// "hybrid" will detect mobile - iOS or Android
187187
if (isPlatform('hybrid')) {
188-
const file = await Filesystem.readFile({
188+
const readFile = await Filesystem.readFile({
189189
path: photo.path!,
190190
});
191-
base64Data = file.data;
191+
base64Data = readFile.data;
192192
} else {
193193
// Fetch the photo, read as a blob, then convert to base64 format
194194
const response = await fetch(photo.webPath!);
@@ -243,12 +243,12 @@ export const usePhotoGallery = () => {
243243
// If running on the web...
244244
if (!isPlatform('hybrid')) {
245245
for (const photo of photosInPreferences) {
246-
const file = await Filesystem.readFile({
246+
const readFile = await Filesystem.readFile({
247247
path: photo.filepath,
248248
directory: Directory.Data,
249249
});
250250
// Web platform only: Load the photo as base64 data
251-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
251+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
252252
}
253253
}
254254

versioned_docs/version-v7/vue/your-first-app/4-loading-photos.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ export const usePhotoGallery = () => {
103103

104104
// CHANGE: Display the photo by reading into base64 format
105105
for (const photo of photosInPreferences) {
106-
const file = await Filesystem.file({
106+
const readFile = await Filesystem.readFile({
107107
path: photo.filepath,
108108
directory: Directory.Data,
109109
});
110-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
110+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
111111
}
112112

113113
photos.value = photosInPreferences;
@@ -192,11 +192,11 @@ export const usePhotoGallery = () => {
192192
const photosInPreferences = photoList.value ? JSON.parse(photoList.value) : [];
193193

194194
for (const photo of photosInPreferences) {
195-
const file = await Filesystem.readFile({
195+
const readFile = await Filesystem.readFile({
196196
path: photo.filepath,
197197
directory: Directory.Data,
198198
});
199-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
199+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
200200
}
201201

202202
photos.value = photosInPreferences;
@@ -288,11 +288,11 @@ export const usePhotoGallery = () => {
288288
const photosInPreferences = photoList.value ? JSON.parse(photoList.value) : [];
289289

290290
for (const photo of photosInPreferences) {
291-
const file = await Filesystem.file({
291+
const readFile = await Filesystem.readFile({
292292
path: photo.filepath,
293293
directory: Directory.Data,
294294
});
295-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
295+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
296296
}
297297

298298
photos.value = photosInPreferences;

versioned_docs/version-v7/vue/your-first-app/5-adding-mobile.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ const savePicture = async (photo: Photo, fileName: string): Promise<UserPhoto> =
4747
// CHANGE: Add platform check
4848
// "hybrid" will detect mobile - iOS or Android
4949
if (isPlatform('hybrid')) {
50-
const file = await Filesystem.readFile({
50+
const readFile = await Filesystem.readFile({
5151
path: photo.path!,
5252
});
53-
base64Data = file.data;
53+
base64Data = readFile.data;
5454
} else {
5555
// Fetch the photo, read as a blob, then convert to base64 format
5656
const response = await fetch(photo.webPath!);
@@ -89,10 +89,10 @@ const savePicture = async (photo: Photo, fileName: string): Promise<UserPhoto> =
8989
// CHANGE: Add platform check
9090
// "hybrid" will detect mobile - iOS or Android
9191
if (isPlatform('hybrid')) {
92-
const file = await Filesystem.readFile({
92+
const readFile = await Filesystem.readFile({
9393
path: photo.path!,
9494
});
95-
base64Data = file.data;
95+
base64Data = readFile.data;
9696
} else {
9797
// Fetch the photo, read as a blob, then convert to base64 format
9898
const response = await fetch(photo.webPath!);
@@ -136,12 +136,12 @@ const loadSaved = async () => {
136136
// If running on the web...
137137
if (!isPlatform('hybrid')) {
138138
for (const photo of photosInPreferences) {
139-
const file = await Filesystem.readFile({
139+
const readFile = await Filesystem.readFile({
140140
path: photo.filepath,
141141
directory: Directory.Data,
142142
});
143143
// Web platform only: Load the photo as base64 data
144-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
144+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
145145
}
146146
}
147147

@@ -185,10 +185,10 @@ export const usePhotoGallery = () => {
185185
let base64Data: string | Blob;
186186
// "hybrid" will detect mobile - iOS or Android
187187
if (isPlatform('hybrid')) {
188-
const file = await Filesystem.readFile({
188+
const readFile = await Filesystem.readFile({
189189
path: photo.path!,
190190
});
191-
base64Data = file.data;
191+
base64Data = readFile.data;
192192
} else {
193193
// Fetch the photo, read as a blob, then convert to base64 format
194194
const response = await fetch(photo.webPath!);
@@ -243,12 +243,12 @@ export const usePhotoGallery = () => {
243243
// If running on the web...
244244
if (!isPlatform('hybrid')) {
245245
for (const photo of photosInPreferences) {
246-
const file = await Filesystem.readFile({
246+
const readFile = await Filesystem.readFile({
247247
path: photo.filepath,
248248
directory: Directory.Data,
249249
});
250250
// Web platform only: Load the photo as base64 data
251-
photo.webviewPath = `data:image/jpeg;base64,${file.data}`;
251+
photo.webviewPath = `data:image/jpeg;base64,${readFile.data}`;
252252
}
253253
}
254254

0 commit comments

Comments
 (0)