Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove text qualifier

Manav Rathi3ea4879cf0d7
diff --git a/desktop/src/main/fs.ts b/desktop/src/main/fs.ts
index 94652d93d9..d8cfe7714c 100644
--- a/desktop/src/main/fs.ts
+++ b/desktop/src/main/fs.ts
@@ -20,7 +20,7 @@ export const fsRm = (path: string) => fs.rm(path);
export const fsReadTextFile = async (filePath: string) =>
fs.readFile(filePath, "utf-8");
-export const fsWriteTextFile = (path: string, contents: string) =>
+export const fsWriteFile = (path: string, contents: string) =>
fs.writeFile(path, contents);
/**
diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.ts
index 17984c1cf0..2a74803020 100644
--- a/desktop/src/main/ipc.ts
+++ b/desktop/src/main/ipc.ts
@@ -24,7 +24,7 @@ import {
fsRename,
fsRm,
fsRmdir,
- fsWriteTextFile,
+ fsWriteFile,
isFolder,
saveStreamToDisk,
} from "./fs";
@@ -129,8 +129,8 @@ export const attachIPCHandlers = () => {
ipcMain.handle("fsReadTextFile", (_, path: string) => fsReadTextFile(path));
- ipcMain.handle("fsWriteTextFile", (_, path: string, contents: string) =>
- fsWriteTextFile(path, contents),
+ ipcMain.handle("fsWriteFile", (_, path: string, contents: string) =>
+ fsWriteFile(path, contents),
);
// - Conversion
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index 057ca9ebb2..c709468cbf 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -115,8 +115,8 @@ const fsRm = (path: string): Promise<void> => ipcRenderer.invoke("fsRm", path);
const fsReadTextFile = (path: string): Promise<string> =>
ipcRenderer.invoke("fsReadTextFile", path);
-const fsWriteTextFile = (path: string, contents: string): Promise<void> =>
- ipcRenderer.invoke("fsWriteTextFile", path, contents);
+const fsWriteFile = (path: string, contents: string): Promise<void> =>
+ ipcRenderer.invoke("fsWriteFile", path, contents);
// - AUDIT below this
@@ -326,7 +326,7 @@ contextBridge.exposeInMainWorld("electron", {
rmdir: fsRmdir,
rm: fsRm,
readTextFile: fsReadTextFile,
- writeTextFile: fsWriteTextFile,
+ writeFile: fsWriteFile,
},
// - Conversion
diff --git a/web/apps/photos/src/services/export/index.ts b/web/apps/photos/src/services/export/index.ts
index 996b911dec..165947f04a 100644
--- a/web/apps/photos/src/services/export/index.ts
+++ b/web/apps/photos/src/services/export/index.ts
@@ -884,7 +884,7 @@ class ExportService {
try {
const exportRecord = await this.getExportRecord(folder);
const newRecord: ExportRecord = { ...exportRecord, ...newData };
- await ensureElectron().fs.writeTextFile(
+ await ensureElectron().fs.writeFile(
`${folder}/${exportRecordFileName}`,
JSON.stringify(newRecord, null, 2),
);
@@ -1076,7 +1076,7 @@ class ExportService {
fileExportName: string,
file: EnteFile,
) {
- await ensureElectron().fs.writeTextFile(
+ await ensureElectron().fs.writeFile(
getFileMetadataExportPath(collectionExportPath, fileExportName),
getGoogleLikeMetadataFile(fileExportName, file),
);
@@ -1105,7 +1105,7 @@ class ExportService {
private createEmptyExportRecord = async (exportRecordJSONPath: string) => {
const exportRecord: ExportRecord = NULL_EXPORT_RECORD;
- await ensureElectron().fs.writeTextFile(
+ await ensureElectron().fs.writeFile(
exportRecordJSONPath,
JSON.stringify(exportRecord, null, 2),
);
diff --git a/web/packages/next/types/ipc.ts b/web/packages/next/types/ipc.ts
index 70e21a10c7..60bbb39f8f 100644
--- a/web/packages/next/types/ipc.ts
+++ b/web/packages/next/types/ipc.ts
@@ -189,16 +189,16 @@ export interface Electron {
*/
rm: (path: string) => Promise<void>;
+ /** Read the string contents of a file at {@link path}. */
+ readTextFile: (path: string) => Promise<string>;
+
/**
* Write a string to a file, replacing the file if it already exists.
*
* @param path The path of the file.
* @param contents The string contents to write.
*/
- writeTextFile: (path: string, contents: string) => Promise<void>;
-
- /** Read the string contents of a file at {@link path}. */
- readTextFile: (path: string) => Promise<string>;
+ writeFile: (path: string, contents: string) => Promise<void>;
};
/*