add functionality to export and load database

This commit is contained in:
Henry
2023-05-14 20:33:43 +01:00
parent 5d5021bf10
commit 6ab1ff1062
7 changed files with 204 additions and 24 deletions
+13
View File
@@ -539,6 +539,19 @@ export const deleteAPIKey = async (keyIdToDelete: string): Promise<ICommonObject
return result
}
/**
* Replace all api keys
* @param {ICommonObject[]} content
* @returns {Promise<void>}
*/
export const replaceAllAPIKeys = async (content: ICommonObject[]): Promise<void> => {
try {
await fs.promises.writeFile(getAPIKeyPath(), JSON.stringify(content), 'utf8')
} catch (error) {
console.error(error)
}
}
/**
* Map MimeType to InputField
* @param {string} mimeType