MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / saveFile

Function saveFile

src/back/ConfigFile.ts:55–65  ·  view source on GitHub ↗
(filePath: string, data: AppConfigData)

Source from the content-addressed store, hash-verified

53 }
54
55 export function saveFile(filePath: string, data: AppConfigData): Promise<void> {
56 return new Promise((resolve, reject) => {
57 // Convert config to json string
58 const json: string = stringifyJsonDataFile(data);
59 // Save the config file
60 fs.writeFile(filePath, json, function(error) {
61 if (error) { return reject(error); }
62 else { return resolve(); }
63 });
64 });
65 }
66
67 function parse(json: any, onError?: (error: string) => void): AppConfigData {
68 return overwriteConfigData(deepCopy(getDefaultConfigData(process.platform)), json, onError);

Callers 2

readOrCreateFileFunction · 0.70
readOrCreateFileSyncFunction · 0.70

Calls 1

stringifyJsonDataFileFunction · 0.90

Tested by

no test coverage detected